Truth is a Java test assertion framework that provides assertions/propositions to apply to objects-under-test. It is intended to be used with the JUnit test infrastructure, and can be used in the context of unit or integration tests.
Truth seeks to apply a fluent interface to testing, and was inspired by FEST, and is the main way that Google writes its android and java tests internally. Its goal is to allow for tests whose assertions are readable and match a quasi-english style, such as assertThat(someString).contains("some substring"). More readable tests make for less error-prone tests.
Truth is an open-source project hosted at Github and is permissively licensed under Apache 2.0, and its main website can be found here.
DoublesSubject forisEqualTo instead of equals since that is a method with a fairly preciseObjectArraySubjectTestVerb, part 1An extension/contrib submodule, for things we want to ship with Truth,
but which may need to be separate artifacts, mostly due to dependency
issues or general bloat. Including our first entry: RE2J
Support for
MessageLiteprotocol buffers is also in extensions, but not released
in 0.29.
ComparisonFailure)null in failure messaging@CheckReturnValue across a wide range of methods (on by default).
Note: various methods are being deprecated in preparation for 1.0. A penultimate
pre-1.0 release will be cut with those deprecated methods intact. Then a 1.0 will
be released with those methods removed. This should give people a chance to
get the 1.0 features and benefits, but have a nice transition phase.