Skip to content

Releases: google/truth

Truth 0.43

25 Feb 21:03
Compare
Choose a tag to compare
  • Updated more dependencies, especially to avoid conflicts with com.google.guava:listenablefuture. (4551488)
  • Added containsAtLeast and containsAtLeastEntriesIn to MapSubject and MultimapSubject. (d44be00)
  • Deleted Subject.failWithRawMessage. Its literal replacement is failWithoutActual(simpleFact(lenientFormat(message, parameters))), but most users will be able to find a shorter way to construct a better message, generally using failWithoutActual. (97f822f)
  • You can now create a Correspondence instance using a lambda or method reference, with the Correspondence.from factory method. (81ac47d)
  • You can now create a Correspondence instance that transforms the actual elements using a lambda or method reference and tests for equality with the expected elements, with the Correspondence.transforming factory method. (c60c71a)
  • You can now create a Correspondence instance that transforms the actual and expected elements using a lambda or method reference and tests for equality, with the Correspondence.transforming factory method. (780ecc2)
  • All Fuzzy Truth assertions now handle exceptions thrown by the functions used to pair elements for diffing (see the javadoc of IterableSubject.UsingCorrespondence.displayingDiffsPairedBy for details). (a675e32)
  • All Fuzzy Truth assertions now handle exceptions thrown by Correspondence.formatDiff (see the javadoc of that method for details). (5006a52)
  • All Fuzzy Truth assertions now handle exceptions thrown by Correspondence.compare (see the javadoc of that method for details). (a474ac1)
  • Enabled tests for ProtoTruth. (9412383)

Truth 0.42

12 Jul 14:32
Compare
Choose a tag to compare
  • Made various dependency fixes and upgrades, including fixing #473 and #467. Note that some annotations-only dependencies are now no longer <provided>. See google/guava#2721 for details, but in short, feel free to exclude them if that works for your setup.
  • Fixed NPE in MapSubject.containsExactly (#468).

Truth 0.41

12 Jun 21:33
Compare
Choose a tag to compare
  • Changed most of Truth's failure messages to a multi-line, key-value format. Provided an API for testing messages of this format. (4a51035)
  • Introduced the new API for building failure messages in a "key: value" format. See Subject.failWithActual and failWithoutActual, which use the new Fact class. (e06ca85)
  • Changed the old API's failure messages to automatically add a "name: ..." field if the user called named(). In some cases, this adds a name where it was missing before; in others, it duplicates a name that is already present. The long-term fix for this will be to migrate to the new failure API, which always includes the name once, and possibly also to delete named() in favor of withMessage(). (911c939)
  • Deprecated failWithRawMessageAndCause. Truth automatically attaches the cause if it's part of the assertion chain. If not, see the deprecation docs for the workaround. (3622e9c)
  • Deprecated failComparing. Use check("foo").that(actual().foo()).isEqualTo(expectedFoo). (2db2a4f)
  • Deprecated the remaining legacy fail* methods. (1f9b2d6)
  • Hid protected method IterableSubject.failWithBadResultsAndSuffix() (5becbfe).
  • Started throwing ComparisonFailure from MapSubject.containsEntry. (4330ec6)
  • Started throwing ComparisonFailure from assertThat(singleElementIterable).containsExactly(otherSingleElementIterable). (e44edd1)
  • Added code to remove Runner and Statement frames from the stack trace. (d2bb074)
  • Added StringSubject.ignoringCase() (13e8054)
  • Added ignoringExtraRepeatedFieldElements() to ProtoTruth. (f070204)
  • Added comparingExpectedFieldsOnly() to ProtoTruth. (08908c1)
  • Removed deprecated MultimapSubject.containsExactly(Multimap). Use containsExactlyEntriesIn(Multimap). (containsExactly(Object k0, Object v0, Object... rest) continues to exist.) (9c80ad5)
  • Removed deprecated isPartiallyOrdered() methods. Use isOrdered() (5becbfe).
  • Started throwing UOE from IterableSubject.isNoneOf() and isNotIn(). (46c8d3d)
  • Switched to Checker Framework @NullableDecl instead of jsr305 @Nullable. Tools that read these annotations may need to be updated to recognize the new annotation. (10ee459)

Truth 0.40

28 Mar 21:05
Compare
Choose a tag to compare
  • Added check(String template, Object... args). Most users of check() should migrate. If the new method doesn't suit your needs, please file a bug. (187a969)
  • Removed getDisplaySubject(), and marked actualCustomStringRepresentation() as @ForOverride. Callers should use actualAsString(); overriders should use actualCustomStringRepresentation(). (47ea976, 24d4c96)
  • Made assertThat(array).isEqualTo(otherArray) compare arrays contents (not array identity) even when the input wasn't statically known to be an array. (ece35ac)
  • Began cleaning stack traces from custom subjects outside of core Truth. (7a6f69d)
  • Enhanced Expect to omit stack frames common to multiple failures. (48b31f7)
  • Put any user messages on their own lines, separate from the main failure message. (6d060b8)
  • Tweaked the format of array failure messages. (ece35ac)
  • Removed the type name from the output of arrays. (f4fabf2)
  • For array subjects, made named() supplement the existing actual value text, not replace it. This brings it in line with other subjects' behaviors. (f4fabf2)
  • Tweaked failure messages for array asList() assertions. (df5c101)
  • Tweaked failure messages for isAnyOf, isNone, and isNotIn to be more consistent. (6233d1b)
  • Changed Subject.fail(String, Object) to stop including class names if the Object's toString() representation matches the value under test's. (This is likely to be uncommon unless you are overriding isEqualTo(), in which case we recommend delegating to super.isEqualTo() when possible.) (7af9c56)
  • Stopped calling actual.equals(null); all objects are assumed to be not equal to null. (c1ab4ed)
  • Added displayingDiffsPairedBy to IterableOfProtosSubject. (a51fc7a)
  • Add support for float and double comparisons in ProtoTruth. (6cd8068)
  • Check only the descriptor identity before comparing messages in ProtoSubject. (7df5790)
  • Add formatted diffs for ProtoTruth Correspondence comparisons. (4b790a3)
  • Removed deprecated (Object expected, double tolerance) overloads of isEqualTo() and isNotEqualTo(). (ca04f65)
  • Added the @CompatibleWith annotation from http://errorprone.info to isSameAs, isNotSameAs, isAnyOf, and isNoneOf. (2487651)
  • Made assertThat(...).is{,Not}InstanceOf(SomeInterface.class) blow up with a helpful message under GWT, rather than always fail in the case of isInstanceOf and always succeed in the case of isNotInstanceOf. (026d922)
  • Made assertThat(null).isInstanceOf(...) fail() under GWT instead of throw NullPointerException. (026d922)

Truth 0.39

05 Jan 16:33
Compare
Choose a tag to compare
  • Changed FailureStrategy to a one-method interface: fail(AssertionError), removing AbstractFailureStrategy.

Truth 0.38

05 Jan 16:07
Compare
Choose a tag to compare
  • Added overloads to containsExactlyElementsIn() and similar methods to accept arrays.
  • Made Expect support concurrent calls to fail().
  • Truth is now built with -target 7. However, it continues to depend on only "Java-6-like" APIs so that it continues to work on old versions of Android. (1688736)
  • Worked around GWT's buggy handling of double[] equality. Also, changed the rendering of double[] values under GWT to more closely match Java. The change requires an API that isn't present in older browers, so please report any problems you encounter. (1a4c679)
  • Made StandardSubjectBuilder.check() final. (1d44b58)

Truth 0.37

11 Dec 18:03
Compare
Choose a tag to compare
  • Delete Subject.failureStrategy. Use Subject.fail*.
  • Delete Truth.THROW_ASSERTION_ERROR and TruthJUnit.throwAssumptionError(). Use Truth.assert_() and TruthJUnit.assume() (and methods like fail() and about(...).that(...) on the resulting objects).
  • Delete SubjectFactory and CustomSubjectBuilderFactory. Use nested types Subject.Factory and CustomSubjectBuilder.Factory, which accept new type FailureMetadata rather than FailureStrategy.
  • Make some Subject constructors protected now that they're useful only from subclasses.
  • Prevent subclassing of DefaultSubject entirely: Use Subject.
  • Enhanced our stripping of stack traces.

Truth 0.36

21 Sep 00:21
Compare
Choose a tag to compare
  • Delete the *Verb* types and associated classes (after migrating Proto-Truth).
  • Delete ExpectationGatherer.
  • Deprecate Subject.failureStrategy, introducing more Subject.fail* methods to take its place.
  • Deprecate Truth.THROW_ASSERTION_ERROR and TruthJUnit.throwAssumptionError(). Users should use Truth.assert_() and TruthJUnit.assume() (and methods like fail() and about(...).that(...) on the resulting objects).
  • Deprecate SubjectFactory and CustomSubjectBuilderFactory, introducing nested types Subject.Factory and CustomSubjectBuilder.Factory to take their place. The nested types accept new type FailureMetadata rather than FailureStrategy, and our Subject classes have been updated accordingly. The main benefit is that, once you update your Subject constructors to accept FailureMetadata, you can expose a Subject.Factory, and it can usually be implemented with a method reference: return FooSubject::new;.

Truth 0.35

28 Aug 18:06
Compare
Choose a tag to compare

Maven Release

  • Remove withFailureMessage, the old name of withMessage.
  • Remove assertAbout(...).withFailureMessage(...) in favor of assertWithMessage(...).about(...).
  • Deprecate ExpectationGatherer.
  • Deprecate the *Verb* types in favor of new *SubjectBuilder* types.
  • Add subjects for IntStream and LongStream.
  • Add the no-arg MultimapSubject.containsExactly() method.
  • Call out empty strings more clearly in collection subjects' failure messages.
  • Make various subjects behave better when used with Expect. Primarily, make any given assertion call fail at most once.
  • In Expect, always output failed expectations, even if an exception is thrown, and always fail the test, even if the exception was expected. Also, always include a stack trace when one was requested, even if the assertion specifies an additional cause.
  • Upgrade Guava dependency. You might notice that we now depend on 22.0-android. Guava says to depend on the Android version because Truth is usable on both Android and the JRE. If Maven or another build tool starts to give you 22.0-android at runtime instead of the "normal" version of Guava, you can override it.

Truth 0.34

23 Jun 15:13
Compare
Choose a tag to compare

Maven Release

  • Add MultimapSubject.containsExactly.
  • Remove the redundant synthetic cause from truth assertion errors.
  • Begin renaming withFailureMessage to withMessage (on AbstractVerb/TestVerb).
  • Deprecate assertAbout(...).withFailureMessage(...) in favor of assertWithMessage(...).about(...).
  • FailureStrategy is fully abstract. Users should prefer AbstractFailureStrategy or one of the alternatives detailed in the javadocs.
  • Lock down assorted APIs that aren't meant to be used / used publicly / subtyped.