Skip to content

Truth 0.33

Compare
Choose a tag to compare
@cgruber cgruber released this 23 May 18:43
· 997 commits to master since this release

Maven Release

Changes to existing Subjects and Core classes

  • [API] Introduce ExpectFailure, a common mechanism for capturing failures in Truth, allowing tests to verify Truth failures without catching AssertionError. Intended primarily for testing Subject implementations.
  • [API] Deprecate PrimitiveDoublesArraySubject.hasvaluesWithin() and
    PrimitiveFloatArraySubject.hasvaluesWithin().
  • [SPI] Introduce AbstractFailureStrategy; users creating their own custom FailureStrategy implementations are encouraged to migrate to this class if possible.
  • [SPI] Add Subject.ignoreCheck() which is similar to Subject.check() but passes a no-op failure strategy, to
    allow chaining to continue when non-short-circuiting failure strategies are used (such as Expect).
  • Restrict visibility of the Platform class, which was never intended to be part of the public API. Most usages can simply be removed / inlined, usages that require GWT compatibility should open feature requests.

Extensions

  • Protocol Buffers

    • Permit Iterables for field numbers, descriptors, and handles with the protocol buffers FieldScope APIs
    • Fix comparison rules for map fields.

Fixes

  • Typo in LiteProtoTruth docs
  • assertThat(Double.NaN).isNaN() in gwt/j2cl now working properly.
  • Variety of improvements to error messages in MultimapSubject and MapSubject
  • ThrowableSubject and Java8 Optional*Subject tests now use ExpectFailure which exposed some bad behavior, now fixed.
  • IterableSubject adds type information to errors when string representations are the same, to clarify some
    ambiguous cases

Misc

  • Internal clean-up of FailureStrategy usage to prepare for FailureStrategy becoming fully abstract
  • Source now formatted via google-java-format
  • For users of ErrorProne, add @SuppressWarnings("TruthSelfEquals") since Truth tests sometimes need to
    test equality against the same reference to prove behavior. Generally ErrorProne will flag that as an error,
    since it can never fail (and is therefore usually a badly written test)
  • Some docs on OptionalSubject updated relating to complex assertions.
  • Fix some sample code containing a bug.

For details, see the complete list of included commits.