Skip to content
Permalink
Branch: master
Commits on Jun 6, 2019
  1. Update to Truth 0.45, and address deprecations.

    cpovirk authored and ronshapiro committed Jun 4, 2019
    Renames may include:
    - containsAllOf => containsAtLeast
    - containsAllIn => containsAtLeastElementsIn
    - isSameAs => isSameInstanceAs
    - isOrdered => isInOrder
    - isStrictlyOrdered => isInStrictOrder
    
    The other major change is to change custom subjects to extend raw Subject instead of supplying type parameters. The type parameters are being removed from Subject. This CL will temporarily produce rawtypes warnings, which will go away when I remove the type parameters (as soon as this batch of CLs is submitted).
    
    Some CLs in this batch also migrate calls away from actualAsString(). Its literal replacement is `"<" + actual + ">"` (unless an object overrides actualCustomStringRepresentation()), but usually I've made a larger change, such as switching from an old-style "Not true that..." failure message to one generated with the Fact API. In that case, the new code usually contains a direct reference to this.actual (a field that I occasionally had to create). Another larger change I sometimes made is to switch from a manual check-and-fail approach to instead use check(...). And sometimes I just remove a withMessage() call that's no longer necessary now that the code uses check(...), or I introduce a check(...) call. (An assertion made with check(...) automatically includes the actual value from the original subject, so there's no need to set it again with withMessage().)
    
    Finally, there's one CL in this batch in which I migrate a Correspondence subclass to instead use Correspondence.from.
    
    -------------
    Created by MOE: https://github.com/google/moe
    MOE_MIGRATED_REVID=251472122
Commits on May 8, 2019
  1. Migrate Truth Subjects from no-arg check() to the overload that accep…

    cpovirk authored and ronshapiro committed May 7, 2019
    …ts a description.
    
    The overload that accepts a description generally produces better failure messages:
    - The first line of the message it produces is something like: "value of: myProto.getResponse()" (where "getResponse()" is taken from the provided description)
    - The last line of the message it produces is something like: "myProto was: response: query was throttled" (the full value of myProto)
    - And the existing text goes in between.
    
    Additional motivation: We are deleting the no-arg overload externally (and probably internally thereafter).
    
    -------------
    Created by MOE: https://github.com/google/moe
    MOE_MIGRATED_REVID=247095743
  2. Instead of calling Subject.actual(), store the actual value in a fiel…

    cpovirk authored and ronshapiro committed May 7, 2019
    …d, and read that.
    
    actual() is being removed.
    
    -------------
    Created by MOE: https://github.com/google/moe
    MOE_MIGRATED_REVID=247039297
Commits on Apr 29, 2019
  1. Update to Truth 0.44.

    cpovirk authored and ronshapiro committed Apr 23, 2019
    -------------
    Created by MOE: https://github.com/google/moe
    MOE_MIGRATED_REVID=244875738
Commits on Jul 2, 2018
  1. Update to Guava 25.1-android.

    cpovirk authored and cgdecker committed Jun 30, 2018
    It's required by Truth 0.41, which we switched to in CL 200574789.
    
    -------------
    Created by MOE: https://github.com/google/moe
    MOE_MIGRATED_REVID=202732649
  2. Update to Truth 0.41, and expect a single failure-message format inst…

    cpovirk authored and cgdecker committed Jun 14, 2018
    …ead of the current multiple possibilities.
    
    Also, update the bundled-for-Ant JUnit from JUnit 3-something to JUnit 4.11. This matches the dependency used by the Maven build. It's necessary to avoid the problem "java.lang.ClassNotFoundException: org.junit.ComparisonFailure." Truth was already using that type as of 0.36[*], so I suspect that we were just getting away with the JUnit 3 dependency because of the vagaries of class loading. Presumably, if a test had ever actually failed in a way that should have produced a ComparisonFailure, the current build setup would have produces the same error.
    
    [*] https://github.com/google/truth/blob/release_0_36/core/src/main/java/com/google/common/truth/Platform.java#L24
    
    -------------
    Created by MOE: https://github.com/google/moe
    MOE_MIGRATED_REVID=200574789
Commits on Apr 11, 2018
  1. Migrate off failWithRawMessageAndCause, which is being deprecated.

    cpovirk authored and ronshapiro committed Apr 10, 2018
    I'm sorry that the replacement is so ugly. Our reason for not supporting this directly is partially that it's needed by only ~1% of subjects. But mostly, we've over time taken the position that Truth is intended for only the "assert" phases of the "arrange, act, assert" testing process. Exceptions, on the other hand, usually come from the earlier phases.
    
    Unfortunately, I still owe everyone a long explanation of *why* we have come to this position. If it's bugging you now, let me know, and I can make it happen.
    
    (And yes, in this particular case, we're basically arguing that Your Subject Is Wrong. Sorry: I'm not trying to get you to delete it or recant or anything; I'm just trying to explain where we're coming from.)
    
    -------------
    Created by MOE: https://github.com/google/moe
    MOE_MIGRATED_REVID=192278109
Commits on Apr 3, 2018
  1. Update tests for upcoming changes to Truth's failure message format.

    cpovirk authored and ronshapiro committed Mar 28, 2018
    We now accept (sigh) 3 versions:
    - The version generated by the latest open-source release of Truth.
    - The version generated by the current internal version of Truth.
    - The version that will be generated once I submit CL 185043225.
    
    I continue to promise to reduce this back to expecting a single version once I release a version of Truth that contains CL 185043225.
    
    -------------
    Created by MOE: https://github.com/google/moe
    MOE_MIGRATED_REVID=190771332
Commits on Mar 20, 2018
  1. Update tests for when withMessage() messages are displayed on separat…

    cpovirk authored and ronshapiro committed Mar 19, 2018
    …e lines from the main failure message.
    
    Before:
    some messsage: the main message
    
    After:
    some message
    the main message
    
    -------------
    Created by MOE: https://github.com/google/moe
    MOE_MIGRATED_REVID=189625749
Commits on Jan 25, 2018
  1. Update maven-javadoc-plugin to 3.0.0.

    cpovirk authored and ronshapiro committed Jan 18, 2018
    This is necessary to build with JDK9.
    (You can still build *for* older versions of Java to maintain compatibility; this is just to work with build tools from JDK9, as will become the Google default.)
    
    As part of that, migrate from additionalparam, which was deprecated and removed last year, to additionalOptions.
    
    -------------
    Created by MOE: https://github.com/google/moe
    MOE_MIGRATED_REVID=182374950
  2. Migrate from fail* calls on deprecated this.failureStrategy to equiva…

    cpovirk authored and ronshapiro committed Sep 21, 2017
    …lent this.fail* calls.
    
    The new this.fail* methods are available in Truth 0.36, which I've imported into the [] Maven repository for people who use that. If I could find a pom/build.xml for your open-source project, this CL updates it.
    
    -------------
    Created by MOE: https://github.com/google/moe
    MOE_MIGRATED_REVID=169571495
Commits on Jun 13, 2016
  1. Fix tests that intend to check that an error is thrown but don't.

    cpovirk authored and sameb committed Apr 4, 2016
    Tests of a testing API often look like this:
    
    	try {
    		runATestThatShouldFail();
    		fail();
    	} catch (AssertionError expected) {
    	}
    
    However, the catch() block can catch not only the expected failure from runATestThatShouldFail() but also the "test did not fail when it should have" failure from fail().
    -------------
    Created by MOE: https://github.com/google/moe
    MOE_MIGRATED_REVID=118941782
You can’t perform that action at this time.