Fluent assertions for Java and Android

Overview
Comments
  • hasValue should be equivalent to isEqualTo

    hasValue should be equivalent to isEqualTo

    opened by ghost 18
  • int vs long in error messages

    int vs long in error messages

    I'm sure this isn't a new issue but I couldn't find an existing report:

    assertThat(ImmutableList.of(1L)).containsExactly(1);
    

    Results in

    java.lang.AssertionError: Not true that <[1]> contains exactly <[1]>. It is missing <[1]> and has unexpected items <[1]>
    

    In the situation where the output would be ambiguous, it would be nice if Truth would disambiguate by adding the "L" suffix as necessary.

    opened by sjamesr 18
  • feature: WIP: Subject code generator, fixes #612

    feature: WIP: Subject code generator, fixes #612

    An implementation of #612 Consider auto-generating assertThat and subject factory for custom subjects

    Generates the bare bones boiler plate subject for later extension.

    Needs several usability

    Issue with this, is if you use the pattern of extending the generated classes - the accessor methods return itself, not the class you've extended. Still super useful to bootstrap many model classes. There may be a way around this - need to think about it. Otherwise, Roaster also allows modifying existing classes - so could try experimenting with mutating existing classes, instead of overwriting them - this will preserve the custom assertion methods added to the class after it's first generated.

    • [ ] Clean up
    • [ ] Merging everything to be in line with the other models (java version, deps etc)
    • [x] Improvements to make it practically accessible.
    • [ ] Template the javadoc statements or other large text bits or code, larger segment templating getting hard to read (no parameter names e.g. just %s's)
    • [x] Some basic refactoring.
    • [x] Add options for targets - like entire package contents as opposed to single classes.
    • [x] Add a tag annotation to use for targets.
    • [x] Generate basic usefull assertions for primitives e.g. employee#hasName().
    • [x] Wrap in a maven plugin - otherwise, it can just be run on a beforeSuite step in unit tests, but that's slow to run it every time.
    • [x] Optional Recursive generation of Subjects so you don’t have to register them all

    Features (done):

    • Dog foods - uses it’s own bootstrapped Subjects to test itself
    • Single entry point for all Managed subjects
    • Template generation for easy incorporation of custom Subjects in your managed source control
    • Ignoring white space and line endings string Subject
    • Various ways to specify classes under test for generation
    • Shade other module classes like java.* classes (UUID etc)
    • Several standard assertion strategies
    • Chain assertion strategy
    • Detection of existing user managed Subject - doesn't regenerate
    • Support for legacy non bean compliant objects like Kafka's ConsumerRecord

    More (done):

    • Optional Recursive generation of Subjects so you don’t have to register them all - going into external modules (i.e. java's UUID, ZonedDateTime etc)
    • Automatic shading of classes who's package is contained in an existing module already (e.g. can't put java.util.UUID's subject into same package java.util)
    • Maven plugin
    More (done):
    • Collections, maps etc generic types are read And used in assertions ie assert.map.containsKey(MyKey key)
    • Customisable extension points for base subjects (like list and map) which will apply to all types in generated tree (where generated entry points are used)
    cla: yes P3 
    opened by astubbs 15
  • IterableSubject.containsMatch(Predicate)

    IterableSubject.containsMatch(Predicate)

    It would be nice to have

    public final void contains(Predicate<?> predicate) {...}
    

    I could then do something like assertThat(myList).contains(p -> p.getId() == 55);

    type=addition 
    opened by ismell 15
  • Figure out if DoubleSubject.isEqualTo is a legitimate method to call

    Figure out if DoubleSubject.isEqualTo is a legitimate method to call

    We mentioned this in (Google-internal, sorry) doc https://docs.google.com/document/d/1YfXxGR3-SZSa56cfnUXa2OnfE9VaJ6vlCJA4UYvgSoU/edit

    But we don't seem to have resolved it.

    I argue that it's useful for at least "isEqualTo(0.0)," since 0.0 is the "unset" value.

    I also argue that it's sad to break symmetry in cases like this (a Dagger test):

    assertThat(component.s()).isEqualTo("sam");
    assertThat(component.i()).isEqualTo(1);
    assertThat(component.d()).isWithin(0).of(4.2d);
    assertThat(component.f()).isEqualTo(5.5f);
    assertThat(component.l()).isEqualTo(6L);
    

    Of course, the tolerance is quite often justified: Whenever you're doing math, I'd worry about using an exact value. But I think there are enough tests that are basically like the above: Return "4.2" from one place, and check that you get "4.2" as an output. The input for that test:

    @Provides
    double d() {
      return 4.2d;
    }
    

    (This will require a real API review doc, but I wanted to get my thoughts down here first. Perhaps others will have comments.)

    opened by cpovirk 15
  • Use hex string compare for byte array mismatch

    Use hex string compare for byte array mismatch

    It would be nice to have something like this:

    expected:<...C6503636F6D000001000[1]> but was:<...C6503636F6D000001000[0]>

    Rather than this:

    Not true that <(byte[]) [124, 112, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 7, 101, 120, 97, 109, 112, 108, 101, 3, 99, 111, 109, 0, 0, 1, 0, 0]> is equal to <[124, 112, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 7, 101, 120, 97, 109, 112, 108, 101, 3, 99, 111, 109, 0, 0, 1, 0, 1]>

    type=addition 
    opened by jart 14
  • Remove extraneous supersource as GWT now supports stripping of `@GwtIncompatible

    Remove extraneous supersource as GWT now supports stripping of `@GwtIncompatible

    Remove extraneous supersource as GWT now supports stripping of @GwtIncompatible-marked methods fields and classes. Also add a local GwtIncompatible annotation, and remove GwtCompatible and the guava versions.

    opened by cgruber 14
  • Release Tags?

    Release Tags?

    The most up to date release seams to be 0.26 (according to maven central) which is not reflected in the README.md. Moreover a couple of release tags seam to be missing.

    opened by ooxi 13
  • Add StringSubject.isEqualToIgnoreCase

    Add StringSubject.isEqualToIgnoreCase

    Sometimes you have to test for string equality while not caring about case sensitivity e.g. when you work with data coming from a case insensitive source (like MySQL with some collation). Includes unit tests.

    CLA will follow.

    cla: yes 
    opened by ooxi 13
  • Consider removing self type <S> from Subject

    Consider removing self type from Subject

    Part of our War on Type Parameters :)

    Other parts:

    • https://github.com/google/truth/issues/192 (to remove <T> from IterableSubject and so forth)
    • Internal bug 16702475 (to remove <T> from Subject in favor of letting each subclass store (or at least cast) the subject itself)

    The new part:

    • this bug (to remove <S> in favor of making each subclass override named())

    Motivation:

    a) IIRC, we have a history of writing things like...

    public class IterableSubject<T, C extends Iterable<T>>
        extends Subject<IterableSubject<S, T, C> S, C> {
    

    ...instead of...

    public class IterableSubject<S extends IterableSubject<S, T, C>, T, C extends Iterable<T>>
        extends Subject<S, C> {
    

    ...which leads to problems when users try to extend the subject.

    b) We need ugly stuff like this...

      @SuppressWarnings({"unchecked", "rawtypes"})
      static <T, C extends Iterable<T>>
          IterableSubject<? extends IterableSubject<?, T, C>, T, C> create(
              FailureStrategy failureStrategy, @Nullable Iterable<T> list) {
        return new IterableSubject(failureStrategy, list);
      }
    

    ...instead of...

    new IterableSubject(failureStrategy, list);
    

    Maybe it would be simplest to eliminate the self type entirely? This would require subclasses to override named(). We could solve much of the problem by making it abstract, but there's still the problem of making sure that users who then extend something like IterableSubject remember to override it again. We could probably have some static analysis or a SubjectTester for this. Possibly we should anyway, though we'll have to make sure people use it.

    opened by cpovirk 12
  • TravisCI: Cache downloaded Maven dependencies

    TravisCI: Cache downloaded Maven dependencies

    With container-based builds, we can use Travis' built-in caching layer to speed up test runs significantly. This change causes ~/.m2 to be cached between builds, so only new/updated dependencies need to be downloaded during build.

    This cuts test times for my fork in Travis by about a minute.

    cla: no 
    opened by benjamin-bader 11
  • Wanted: Truth8Junit to support Java 8 types with assume()

    Wanted: Truth8Junit to support Java 8 types with assume()

    I found myself wanting to use a java.util.Optional with TruthJunit.assume():

        assume().that(javaUtilOptional).isPresent();
    

    Unfortunately this doesn't work, since TruthJunit doesn't support Java 8 types. Hence this feature request: It's be nice to have a Truth8Junit (analogous to Truth8) to fill this gap.

    P3 
    opened by kaibolay 2
  • Upgrade from [6-year-old](https://repo1.maven.org/maven2/com/google/protobuf/protobuf-lite/3.0.1/) `protobuf-lite` to its modern equivalent, `protobuf-javalite`.

    Upgrade from [6-year-old](https://repo1.maven.org/maven2/com/google/protobuf/protobuf-lite/3.0.1/) `protobuf-lite` to its modern equivalent, `protobuf-javalite`.

    Upgrade from 6-year-old protobuf-lite to its modern equivalent, protobuf-javalite.

    This change should mostly not be user-visible, since we declare this dependency as optional.

    The new version doesn't support the optimize_for = LITE_RUNTIME option in .proto files, presumably on the theory that you should be able to compile the same protobuf for both the "lite" and "speed" runtimes. Unfortunately, xolstice/protobuf-maven-plugin does not provide a way to pass the lite option to the protobuf compiler. (That option was added in https://github.com/xolstice/protobuf-maven-plugin/commit/3ae165e5f6b33f8a6221ece11cc79a7df5eeb8df, but that is not yet part of a release. And the project doesn't appear very active lately.)

    So we can't generate the Java protobuf classes with that plugin. Maybe there's another plugin we could use, if only one that runs an arbitrary executable? But for now, I'm taking another approach: I'm submitting the generated sources.

    To generate them, I ran mvn clean install -X -e, found the location of the protobuf executable and arguments in the output, and ran it with --java_out=lite:/the/path/from/the/output. Then I tweaked the Maven setup to build those sources instead of generating and building the protobuf ones.

    Yuck. This could cause someone some frustration down the line when it comes time to make a change to the test protos. But given that we haven't had to change those protos yet in their 6+ years of existence, I'm hoping for the best.

    Another alternative for us to consider is to just not run these specific tests in our open-source build.

    RELNOTES=n/a

    opened by copybara-service[bot] 0
  • Consider reducing ImmutableList array copying

    Consider reducing ImmutableList array copying

    This is simply an observation and not a problem, so you are welcome to close as won't fix. I profiled a test build task to see if there its doing anything dumbly inefficient for a faster CI run. Overall it seems fine and GC pauses are okay, but I did notice that the majority of allocations comes from SubjectUtils building ImmutableList instances. See the attached jfr recording and the JMC and JProfiler screenshots below for the cpu and memory hotspots.

    A few obvious optimizations might be,

    • concat is often called by methods with names like prependNameIfAny that pass an empty collection. Since ImmutableList.copyOf is given a wrapped iterator it must always copy, even if the only populated iterator is an ImmutableList.
    • append is called with a known size of elements, but the builder is not presized so it must grow to accommodate.
    • It's not clear if ImmutableList is a benefit here as internal data that does not appear to be further modified. You might consider using lightweight wrappers (Arrays.asList, Collections.unmodifiableList) if a safe and non-intrusive change.
    Screen Shot 2022-10-23 at 4 33 28 PM Screen Shot 2022-10-23 at 4 46 52 PM Screen Shot 2022-10-23 at 4 33 57 PM Screen Shot 2022-10-23 at 4 46 18 PM P3 type=performance 
    opened by ben-manes 2
  • Migrate from legacy com.google.gwt to org.gwtproject.

    Migrate from legacy com.google.gwt to org.gwtproject.

    Migrate from legacy com.google.gwt to org.gwtproject.

    org.gwtproject starts being available at the 2.10.0 release, so upgrade to that where necessary.

    See https://github.com/google/auto/pull/1342#issuecomment-1165230080

    RELNOTES=n/a

    opened by copybara-service[bot] 0
  • Add MapSubject#containsAnyOf

    Add MapSubject#containsAnyOf

    I have a test that can create a map with one of two possible entries. It would be nice if I could use containsAnyOf like I can with an IterableSubject.

    type=addition P4 
    opened by nakulj 2
Releases(release_1_1_3)
  • release_1_1_3(May 25, 2021)

    • Fixed a bug in how comparingExpectedFieldsOnly() handles oneof fields. (f27208428)
    • Improved comparingExpectedFieldsOnly to work when required fields are absent. (f27208428)
    • Changed Subject.toString() to throw UnsupportedOperationException. (fa4c7b512)
    Source code(tar.gz)
    Source code(zip)
  • release_1_1_2(Jan 23, 2021)

    This release completes the feature that I got wrong in 1.1.1 -- the ability to exclude our JUnit 4 dependency and still use standard Truth assertions.

    • Made it possible for users to exclude our JUnit 4 dependency and still use standard Truth assertions -- really this time, even in cases in which excluding the dependency failed under 1.1.1. (JUnit 4 is still required for some advanced features, like Expect, ExpectFailure, and TruthJUnit.assume().) (948f3edca)
    • When JUnit 4 is excluded from the classpath, the AssertionError Truth generates as a substitute for ComparisonFailure now includes the expected and actual values that were missing in 1.1.1. (6b0140730)
    Source code(tar.gz)
    Source code(zip)
  • release_1_1_1(Jan 22, 2021)

    We recommend not trying to exclude our JUnit dependency even under this release. We will release 1.1.2 with better handling for the missing dependency shortly.

    • ~~Made it possible for users to exclude our JUnit 4 dependency and still use standard Truth assertions. (JUnit 4 is still required for some advanced features, like Expect, ExpectFailure, and TruthJUnit.assume().) (2d65326ec)~~
      • Update: This appears to let users exclude the dependency in some cases but not all. We are working on a fix.
      • Update 2: Also, even if you succeed in excluding the dependency in your environment, you will see failure messages that are missing information. We have a fix for this ready.

    If you wish to exclude our JUnit dependency, you may wish to consider this alternative approach. That approach may be worthwhile even after we fix the bugs described above.

    I apologize for the trouble.

    Source code(tar.gz)
    Source code(zip)
  • release_1_1(Oct 20, 2020)

    • Fixed (we think :)) R8 compilation failure: Error: com.android.tools.r8.errors.b: Compilation can't be completed because `org.objectweb.asm.ClassVisitor` and 1 other classes are missing. (0bfa285fa)
    • Added unpackingAnyUsing(TypeRegistry, ExtensionRegistry). If you call this method, ProtoTruth will attempt to unpack Any messages before comparing them. (b50d878b)
    • Added formattingDiffsUsing methods to IterableSubject and MapSubject. This allows you to get failure messages which show diffs between the actual and expected elements (like you get with comparingElementsUsing) while still comparing them using object equality. (ae997be77)
    • Changed Checker Framework annotations from checker-qual to qual. (e71b57b9f) With this change, we inadvertently introduced Java 8 bytecode into our dependencies. Please report problems on #882. Sorry for the trouble.
    • Added null checks to StringSubject. (3481ab0af)
    • Included ASM as a dependency (non-<optional>) by default. It is still safe to exclude if you want to minimize dependencies, but by including it, you may see better failure messages. (aea78e81c)
    • Removed dependency on gwt-user. (b54e9ef50fe670bf93dd3b2b6851423be631b429)
    • API documentation for Truth classes is now easier to reach. For example, for StringSubject, visit truth.dev/StringSubject. Also, more easily access the index at truth.dev/api.
    Source code(tar.gz)
    Source code(zip)
  • release_1_0_1(Jan 14, 2020)

    • Changed failure messages to identify trailing whitespace in failed string comparisons. (7a58a45b)
    • Moved gwt-user to test scope. (51bbbf42)
    • Fixed handling of proto maps with keys equal to the key type's default value. (8ebfe2ab)
    • Worked around what seems to be a classloading bug in old versions of some vendors' Android runtimes. (02c5e79925d455331377f3e6640cc450aecf6774)
    Source code(tar.gz)
    Source code(zip)
  • release_1_0(Jul 8, 2019)

    Truth is a library for performing assertions in tests:

    assertThat(notificationText).contains("[email protected]");
    

    Truth is owned and maintained by the Guava team. It is used in the majority of the tests in Google’s own codebase.

    For more information, see our full documentation at truth.dev, or start with our higher-level blog post.

    Users of AssertJ will be particularly interested in our comparison of Truth and AssertJ.


    Truth 1.0 contains no changes relative to 1.0-rc2. For a list of changes since Truth 0.46, see the release notes for rc1 and rc2.

    Now that we have reached 1.0 (after eight years! We're sorry, and we thank you again for your patience), we will maintain binary compatibility.

    Source code(tar.gz)
    Source code(zip)
  • release_1_0_rc2(Jul 1, 2019)

    Sorry for the last-second changes. We still expect to release 1.0 on July 8.

    • Changed DoubleSubject and FloatSubject to override isEqualTo and isNotEqualTo instead of declaring an overload. (4743c148)
    • Changed MultimapSubject.UsingCorrespondence methods containsExactly and containsAtLeast to require an E for their one non-varargs value argument, and removed their type parameters. (4743c148)
    • Eliminated type parameters on MapSubject.UsingCorrespondence and MultimapSubject.UsingCorrespondence methods containsExactlyEntriesIn and containsAtLeastEntriesIn. (4743c148)
    • Changed IntStreamSubject and LongStreamSubject methods isInOrder and isInStrictOrder to require a compatible Comparator. (4743c148)
    Source code(tar.gz)
    Source code(zip)
  • release_1_0_rc1(Jun 27, 2019)

    We expect to release 1.0 (and publish an official announcement) on Monday, July 8.

    • Made assertThat(0.0).isEqualTo(0) pass, despite the mix of double and int. (And likewise for float and int.) This extends existing support that previously applied only to integral types. (1c5f9e8a)
    • Added int overloads of isGreaterThan, isLessThan, isAtLeast, and isAtMost. (dc92786f)
    • Removed the overload of StandardSubjectBuilder.fail(...) that accepts a message. Instead of assert_().fail(...), use assertWithMessage(...).fail(). Similarly, instead of expect.fail(...), use expect.withMessage(...).fail(), and so forth. (f6875d6d)
    • Removed DefaultSubject. Use plain Subject. (f6875d6d)
    • Removed AtomicLongMapSubject. In most cases, you can assert on the asMap() view instead. (f6875d6d)
    • Removed Optional*Subject.hasValueThat(). Instead of assertThat(optional).hasValueThat()...., use assertThat(optional.getAs*())..... (f6875d6d)
    Source code(tar.gz)
    Source code(zip)
  • release_0_46(Jun 25, 2019)

    • Removed deprecated containsAllOf and containsAllIn. Use containsAtLeast and containsAtLeastElementsIn, which are equivalent. (5de3d216)
    • Removed deprecated isOrdered and isStrictlyOrdered. Use isInOrder and isInStrictOrder, which are equivalent. (5de3d216)
    • Removed deprecated SortedMapSubject and SortedSetSubject. Users will have to perform assertions directly on the result of methods like firstKey. We haven't found sufficient demand for the classes to keep them. (057ef315)
    • Removed deprecated ListMultimapSubject, SetMultimapSubject, and ProtoTruth equivalents, which add little to the general Multimap subjects. (057ef315)
    • Removed the type parameters from Subject. If you subclass this type (or declare it as a method return type, etc.), you will have to update those usages at the same time you update Truth. Or you can remove the type parameters from your usages (temporarily introducing rawtypes/unchecked warnings, which you may wish to suppress) and then update Truth (at which point the warnings will go away and you can remove any suppressions). (3740ee65) To remove the type parameters from Subject subclasses, you can get most of the way there with a Perl-compatible regex search-and-replace operation: s/\bSubject<([^<>]*|[^<>]*<[^<>]*>[^<>]*|[^<>]*<[^<>]*>[^<>]*<[^<>]*>[^<>]*|[^<>]*<[^<>]*<[^<>]*>[^<>]*>)>/Subject/g
    • Removed the self-type parameter of ComparableSubject and most of the type parameters of IterableOfProtosSubject, MapWithProtoValuesSubject, and MultimapWithProtoValuesSubject. If you subclass any of those types (or declare them as method return types, etc.), you will have to update those usages at the same time you update Truth. Or you can remove the type parameters from your usages, update Truth, and then add back the remaining type parameters. (e611568b)
    • Removed the type parameters of ProtoSubject and LiteProtoSubject. If you subclass either of those types (or declare them as method return types, etc.), you will have to update those usages at the same time you update Truth. Or you can remove the type parameters from your usages (temporarily introducing rawtypes/unchecked warnings, which you may wish to suppress) and then update Truth (at which point the warnings will go away and you can remove any suppressions). (eb3852c4)
    • Removed deprecated actual(), getSubject(), named(), internalCustomName(), and actualAsString(). To automate most migrations, we've provided StoreActualValueInField and NamedToWithMessage (and a quick-and-dirty regex version for common cases). (If you are migrating manually, you may need to know how to handle java.util.Optional, Stream, and other types that aren't built in.) You might also be interested in our notes from the API Review of this decision. (c1db1b78)
    • Changed ProtoSubject to not extend ProtoFluentAssertion. It still contains all the same methods, except that isEqualTo and isNotEqualTo now require a Message, rather than accept any Object. (777af33d)
    • Deprecated the overload of StandardSubjectBuilder.fail(...) that accepts a message. Instead of assert_().fail(...), use assertWithMessage(...).fail(). Similarly, instead of expect.fail(...), use expect.withMessage(...).fail(), and so forth. (227b559e)
    • Deprecated AtomicLongMapSubject. In most cases, you can assert on the asMap() view instead. (19e1f22c)
    • Deprecated Optional*Subject.hasValueThat(). Instead of assertThat(optional).hasValueThat()...., use assertThat(optional.getAs*())..... (227b559e)
    • Changed assertWithMessage to throw an exception if given format arguments but a null format string. (31e44cc3d2597b90986122853c149d68ea2c5cde)
    • Reimplemented the message-accepting overload of fail(...) in terms of withMessage(...). This is mostly a no-op but can affect behavior in unusual cases. For details, see the commit description. (a52f89b9)
    • Made IterableSubject.isEqualTo produce the same message format as containsExactly. (27a9111c504648ab830929730d6a2b0face5d23d)
    • Introduced TruthFailureSubject.truthFailures() factory for callers that want to test Truth failure messages with expect, assertWithMessage, etc. (c1db1b78)
    Source code(tar.gz)
    Source code(zip)
  • release_0_45(May 30, 2019)

    We are pushing hard to release a Truth 1.0 by June 30, after which we don't expect to remove any more APIs. Thanks for your patience with both our slow progress over the past several years and our rapid churn now.

    To use the migration tools below, you'll need to set up Error Prone and configure our tools as plugins to run in patch mode.

    Deletions:

    • Removed deprecated Subject.isSameAs and isNotSameAs. Use isSameInstanceAs and isNotSameInstanceAs, which are equivalent. (36200e6a)
    • Hid the constuctor of Correspondence. Use the class's static factory methods instead. The most mechanical migration is usually to Correspondence.from. To help with migration, we're released CorrespondenceSubclassToFactoryCall. (11da1ca2)
    • Removed deprecated Subject.fail* methods. See Subject.failWithActual and failWithoutActual, which use the new Fact class. To help with migration, we're released FailWithFacts (and also ImplementAssertionWithChaining, which is also sometimes useful for these migrations), though you will likely need to make manual changes, as well. (36200e6a)
    • Removed deprecated no-arg Subject.check(). Use the overload that accepts a description. (To help with this migration, we have added ProvideDescriptionToCheck to Error Prone -- but then removed it before it became part of a release, so you'll need to pull it in manually.) (36200e6a)
    • Removed deprecated MathUtil. For similar static methods, see Guava's DoubleMath.fuzzyEquals. But callers from custom Subject implementations may prefer an approach like check("score()").that(actual.score()).isWithin(tolerance).of(expected). (7b2876d0)
    • Removed deprecated createAndEnableStackTrace(). Use create(), which now also enables stack traces. (9362f4cb)

    Deprecations:

    • Deprecated isOrdered() and isStrictlyOrdered(). Use isInOrder() and isInStrictOrder(), which are equivalent. (146080a5, 386207d5)
    • Deprecated containsAll* on ProtoTruth, *StreamSubject, and Primitive*ArraySubject.*ArrayAsIterable. Use containsAtLeast*, which is equivalent. (82c1f2dc, 386207d5)
    • Deprecated Subject.actual(). Instead of calling it, declare your own field to store the actual value. To automate most migrations, we've provided StoreActualValueInField. (297c0f1e)
    • Deprecated Subject.named. Instead of assertThat(foo).named("foo"), use assertWithMessage("foo").that(foo). For custom subjects, use assertWithMessage("foo").about(foos()).that(foo). For other scenarios, see this FAQ entry about adding messages. To automate most migrations, we've provided NamedToWithMessage (and a quick-and-dirty regex version for common cases). You might be interested in our notes from the API Review of this decision. (08afb24e)
    • "Deprecated" the type parameters on Subject. To prepare for their removal in the next release, you can edit your code today to refer to the raw Subject type. (Kotlin Subject authors, see below.) Also "deprecated" the self-type parameter on ComparableSubject. Again, you can prepare your code by referring to raw ComparableSubject (and later change it to refer to ComparableSubject<T> when the class has only one type parameter next release). Similarly, "deprecated" the type parameters on ProtoSubject and LiteProtoSubject, along with most of the type parameters of IterableOfProtosSubject, MapWithProtoValuesSubject, and MultimapWithProtoValuesSubject. (21c29f77, 5abd9edc)
    • Loosened type parameters on Subject.Factory. This permits custom Subject subclasses extend raw Subject instead of Subject<FooSubject, Foo> to prepare for when we remove the type parameters from Subject entirely.
    • Deprecated DefaultSubject. Use plain Subject. (7b5311b4)
    • Deprecated SortedMapSubject and SortedSetSubject. Users will have to perform assertions directly on the result of methods like firstKey. We haven't found sufficient demand for the classes to keep them. (46aebcf4)
    • Deprecated the SetMultimap-specific and ListMultimap-specific Subjects, which add little to the general Multimap subjects. (2103fee1)
    • Deprecated actualAsString() and internalCustomName(). They exist primarily to support named(), which is being removed. (d69ba29f)

    Other migration notes:

    • The order in which you migrate can be important: Migrate off actual() and named() before removing type parameters from custom Subject classes.
    • The tool we'll release for migrating off named requires that custom Subject classes expose a Subject.Factory, as described in our docs about extensions.
    • To remove the type parameters from Subject subclasses, you can get most of the way there with a Perl-compatible regex search-and-replace operation: s/\bSubject<([^<>]*|[^<>]*<[^<>]*>[^<>]*|[^<>]*<[^<>]*>[^<>]*<[^<>]*>[^<>]*|[^<>]*<[^<>]*<[^<>]*>[^<>]*>)>/Subject/g

    Features:

    • For very simple tests, failure messages will include a "value of:" line. For example, the failure message of assertThat(fetchLogMessages()).isEmpty() might contain "value of: fetchLogMessages()." This feature is not available under Android or GWT, and it is only available if you have ASM on your classpath.
    • Exposed the constructors of ThrowableSubject, MapSubject, and MultimapSubject to subclasses. Note that actually extending those subjects won't fully work until we remove the type parameters from Subject. (1a39d5af, 32f76a59)
    • Temporarily made DefaultSubject extensible again. Kotlin subjects can now extend DefaultSubject instead of Subject. This lets those subjects compile both before and after we remove the type parameters from Subject. After we remove the type parameters, Kotlin subjects should extend Subject again (with no type parameters), as we'll later remove DefaultSubject. (6e45b276)
    • Made ProtoTruth Subject classes extend IterableSubject, MapSubject, and MultimapSubject. (1a39d5af).
    • Updated stack-trace cleaning to handle reflection under Java 9.
    Source code(tar.gz)
    Source code(zip)
  • release_0_44(Apr 5, 2019)

    To use the migration tools below, you'll need to set up Error Prone and configure our tools as plugins to run in patch mode.

    • Deprecated Subject.isSameAs and isNotSameAs. Use isSameInstanceAs and isNotSameInstanceAs, which are equivalent. (bc845f0d)
    • Deprecated IterableSubject.containsAllOf and containsAllIn. Use the containsAtLeast and containsAtLeastElementsIn, which are equivalent. (bc845f0d)
    • Deprecated the no-arg Subject.check(). Use the overload that accepts a description. (To help with this migration, we have added ProvideDescriptionToCheck to Error Prone -- but then removed it before it became part of a release, so you'll need to pull it in manually.) (bc845f0d)
    • Deprecated Expect.createAndEnableStackTrace(). Expect.create() now does the same thing. (bc845f0d)
    • Deprecated the constructor of Correspondence. Instead of extending the type, use its new static factories. To help with migration, we're released CorrespondenceSubclassToFactoryCall. (bc845f0d, 8bd19b47)
    • Deprecated MathUtil. For similar static methods, see Guava's DoubleMath.fuzzyEquals. But callers from custom Subject implementations may prefer an approach like check("score()").that(actual.score()).isWithin(tolerance).of(expected). (bc845f0d)
    • Removed deprecated ComparableSubject.comparesEqualTo and Primitive{Double,Float}ArraySubject.hasValues{,Not}Within. (cc796b34)
    • Removed deprecated ThrowableSubject.hasMessage() (3164a248)
    • You can now create a Correspondence instance that adds in diff-formatting behavior to an existing Correspondence using Correspondence.formattingDiffsUsing. (d2223603)

    Also note that the next version of Error Prone will include ImplementAssertionWithChaining, which is sometimes useful for migrating off the deprecated Subject.fail* methods.

    Source code(tar.gz)
    Source code(zip)
  • release_0_43(Feb 25, 2019)

    • Updated more dependencies, especially to avoid conflicts with com.google.guava:listenablefuture. (45514882)
    • Added containsAtLeast and containsAtLeastEntriesIn to MapSubject and MultimapSubject. (d44be00f)
    • 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. (97f822f2)
    • You can now create a Correspondence instance using a lambda or method reference, with the Correspondence.from factory method. (81ac47da)
    • 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. (c60c71a2)
    • 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. (780ecc2d)
    • 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). (a675e321)
    • All Fuzzy Truth assertions now handle exceptions thrown by Correspondence.formatDiff (see the javadoc of that method for details). (5006a52a)
    • All Fuzzy Truth assertions now handle exceptions thrown by Correspondence.compare (see the javadoc of that method for details). (a474ac14)
    • Enabled tests for ProtoTruth. (94123837)
    Source code(tar.gz)
    Source code(zip)
  • release_0_42(Jul 12, 2018)

    • Made various dependency fixes and upgrades, including fixing https://github.com/google/truth/issues/473 and https://github.com/google/truth/issues/467. Note that some annotations-only dependencies are now no longer <provided>. See https://github.com/google/guava/issues/2721 for details, but in short, feel free to exclude them if that works for your setup.
    • Fixed NPE in MapSubject.containsExactly (https://github.com/google/truth/issues/468).
    Source code(tar.gz)
    Source code(zip)
  • release_0_41(Jun 12, 2018)

    • Changed most of Truth's failure messages to a multi-line, key-value format. Provided an API for testing messages of this format. (4a510350)
    • Introduced the new API for building failure messages in a "key: value" format. See Subject.failWithActual and failWithoutActual, which use the new Fact class. (e06ca85f)
    • 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(). (911c9394)
    • Deprecated failWithRawMessageAndCause. Truth automatically attaches the cause if it's part of the assertion chain. If not, see the deprecation docs for the workaround. (3622e9cf)
    • Deprecated failComparing. Use check("foo").that(actual().foo()).isEqualTo(expectedFoo). (2db2a4fa)
    • Deprecated the remaining legacy fail* methods. (1f9b2d63daaae2ecc49f9cd4b87d1bd84c71ba04)
    • Hid protected method IterableSubject.failWithBadResultsAndSuffix() (5becbfe5).
    • Started throwing ComparisonFailure from MapSubject.containsEntry. (4330ec62)
    • Started throwing ComparisonFailure from assertThat(singleElementIterable).containsExactly(otherSingleElementIterable). (e44edd16)
    • Added code to remove Runner and Statement frames from the stack trace. (d2bb0743)
    • Added StringSubject.ignoringCase() (13e80543)
    • Added ignoringExtraRepeatedFieldElements() to ProtoTruth. (f0702044)
    • Added comparingExpectedFieldsOnly() to ProtoTruth. (08908c17)
    • Removed deprecated MultimapSubject.containsExactly(Multimap). Use containsExactlyEntriesIn(Multimap). (containsExactly(Object k0, Object v0, Object... rest) continues to exist.) (9c80ad50)
    • Removed deprecated isPartiallyOrdered() methods. Use isOrdered() (5becbfe5).
    • Started throwing UOE from IterableSubject.isNoneOf() and isNotIn(). (46c8d3d2)
    • Switched to Checker Framework @NullableDecl instead of jsr305 @Nullable. Tools that read these annotations may need to be updated to recognize the new annotation. (10ee459c)
    Source code(tar.gz)
    Source code(zip)
  • release_0_40(Mar 28, 2018)

    • 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. (187a9699)
    • Removed getDisplaySubject(), and marked actualCustomStringRepresentation() as @ForOverride. Callers should use actualAsString(); overriders should use actualCustomStringRepresentation(). (47ea976e, 24d4c960)
    • Made assertThat(array).isEqualTo(otherArray) compare arrays contents (not array identity) even when the input wasn't statically known to be an array. (ece35ace)
    • Began cleaning stack traces from custom subjects outside of core Truth. (7a6f69d0)
    • Enhanced Expect to omit stack frames common to multiple failures. (48b31f74)
    • Put any user messages on their own lines, separate from the main failure message. (6d060b82)
    • Tweaked the format of array failure messages. (ece35ace)
    • Removed the type name from the output of arrays. (f4fabf2e)
    • For array subjects, made named() supplement the existing actual value text, not replace it. This brings it in line with other subjects' behaviors. (f4fabf2e)
    • Tweaked failure messages for array asList() assertions. (df5c101a)
    • Tweaked failure messages for isAnyOf, isNone, and isNotIn to be more consistent. (6233d1b5)
    • 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.) (7af9c567)
    • Stopped calling actual.equals(null); all objects are assumed to be not equal to null. (c1ab4ede)
    • Added displayingDiffsPairedBy to IterableOfProtosSubject. (a51fc7ad)
    • Add support for float and double comparisons in ProtoTruth. (6cd80683)
    • Check only the descriptor identity before comparing messages in ProtoSubject. (7df57902)
    • Add formatted diffs for ProtoTruth Correspondence comparisons. (4b790a30)
    • Removed deprecated (Object expected, double tolerance) overloads of isEqualTo() and isNotEqualTo(). (ca04f65b)
    • Added the @CompatibleWith annotation from http://errorprone.info to isSameAs, isNotSameAs, isAnyOf, and isNoneOf. (24876516)
    • 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. (026d9229)
    • Made assertThat(null).isInstanceOf(...) fail() under GWT instead of throw NullPointerException. (026d9229)
    Source code(tar.gz)
    Source code(zip)
  • release_0_39(Jan 5, 2018)

  • release_0_38(Jan 5, 2018)

    • 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. (16887362)
    • 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. (1a4c6797)
    • Made StandardSubjectBuilder.check() final. (1d44b587)
    Source code(tar.gz)
    Source code(zip)
  • release_0_37(Dec 11, 2017)

    • 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.
    Source code(tar.gz)
    Source code(zip)
  • release_0_36(Sep 21, 2017)

    • 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;.
    Source code(tar.gz)
    Source code(zip)
  • release_0_35(Aug 28, 2017)

    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.
    Source code(tar.gz)
    Source code(zip)
  • release_0_34(Jun 23, 2017)

    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.
    Source code(tar.gz)
    Source code(zip)
  • release_0_33(May 23, 2017)

    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.

    Source code(tar.gz)
    Source code(zip)
  • release_0_32(Feb 23, 2017)

    Maven Release

    New Subjects

    • OptionalIntSubject (in java8 extension)
    • StreamSubject (in java8 extension)

    Changes to existing Subjects and Core classes

    • add .hasValueThat() methods to primitive optionals which chain to the appropriate subject
    • ThrowableSubject.hasMessageThat() which chains to StringSubject, in place of hasMessage(String)
    • ThrowableSubject.hasCauseThat() which chains to ThrowableSubject around the cause
    • make isInstanceof() and related methods abort hard, under -XdisableClassMetadata.
    • Introduce DelegatedVerbFactory as a more powerful (but looser) alternative to SubjectFactory
    • make MultimapSubject use usingCorrespondence() to allow custom "Fuzzy" equality for contains ops.
    • Allow usingExactEquality on floating point subjects take Number subtypes, not just floating point types.
    • Allow one-arg isEqualTo() to be used for primitive arrays of floating point types, implementing an agreed upon algorithm
    • Add containsCell(Cell) and doesNotContainCell(Cell) to TableSubject.
    • Include more readable hexadecimals when isEqualTo fails on a byte[].

    New Extensions

    • Protocol Buffers
      • Support for lite and heavy (with proto-reflection) protocol buffers
      • IterableProtoSubject

    Fixes

    • Make asList() chaining methods obey named()

    Misc

    • Code all formated with google-java-format
    • some error-prone notified improvemetns

    For details, see the complete list of included commits.

    Source code(tar.gz)
    Source code(zip)
  • release_0_31(Feb 23, 2017)

    Maven Release

    New Subjects

    • SortedMapSubject and SortedSetSubject

    Changes to existing Subjects and Core classes

    • Add GWT support to Java8 subjects
    • Lock down some of the Subject infrastructure, making several methods final
    • Add @SafeVarargs to some methods where appropriate
    • Depend on Guava 20.
    • More use of usingTolerance() for relevant Subjects
    • Various failure message improvements

    New Extensions

    • Protocol Buffers
      • Support for lite and heavy (with proto-reflection) protocol buffers
      • IterableProtoSubject

    For details, see the complete list of included commits.

    Source code(tar.gz)
    Source code(zip)
  • release_0_30(Sep 8, 2016)

    Pushing towards a 1.0 release Maven Release

    New Subjects

    • OptionalSubject (for java.util.Optional, accessible via Truth8.assertThat(Optional<T>)) (see details under "new extensions" below)

    Changes to existing Subjects and Core classes

    • Preliminary versions of "Fuzzy Equality" for doubles/floats. See DoublesSubject for new APIs, and we'll be updating the docs on fuzzy equality soon.

      • Subject implementers should note changes to the Service Provider Interface (SPI) for writing custom Subject subclasses:
        • getSubject() -> actual()
        • getDisplaySubject() -> actualAsString()
        • If you want to provide a subject-specific string representation of the type being tested, a new method actualCustomStringRepresentation() can be overridden. The deprecated getDisplaySubject() and getSubject() methods should not be overridden (and will be deleted in Truth 1.0. The renamed methods are final. actualAsString() has logic that not only consumes the string representation (default or custom) but also honors .named() and other contextual formatting.
    • More evolution of "Fuzzy" truth - near-value approximation for certain types rather than strict equality is now supported by way of a "correspondence" mechanism, and the capabilities are being extended to many existing subjects.

      • To use:

            assertThat(actualIterable)
                .comparingElementsUsing(correspondence)
                .containsExactlyElementsIn(expectedIterable);
        

        Currently supports containsExactlyElementsIn(Iterable<E>), doesNotContain(E), and contains(E) methods. Subjects for Map, Iterable, and the Multimap types all support correspondence. For more detail, see the javadoc for IterableSubject.UsingCorrespondence and Correspondence

    • .named() now supports a varargs/format construction, such as:

            assertThat(someBooleanFunction())
                .named("processed %s(%s)", foo, bar)
                .isTrue();
      

      This results in a more suitable error message: Not true that processed foo(bar) <false> is true as compared with the default message, and requires less string concatenation where that may prove awkward

    New Extensions

    • Add an extension for Java8 types, initially containing a subject forjava.util.Optional
      • Include "com.google.truth.extensions:truth-java8-extension:0.30" in your build dependencies

      • To use:

            import static com.google.common.truth.Truth8.assertThat;
            import java.util.Optional;
            public class MyTest {
              @Test public void testOptional() {
                Optional<String> o = Optional.of("Foo");
                assertThat(o).isPresent(); //succeeds
                assertThat(o).hasValue("Foo"); //succeeds
                assertThat(o).isEmpty(); // fails
              }
            }
        

    Fixes

    • Fix a missing @Nullable in AbstractVerb.that(T)
    • Various cleanups of code, docs, readme, javadocs, and contribution
    Source code(tar.gz)
    Source code(zip)
  • release_0_29(Aug 10, 2016)

    Pushing towards a 1.0 release Maven Release

    New Subjects

    • AtomicLongMapSubject

    Changes to existing Subjects and Core classes

    • Preliminary versions of "Fuzzy Equality" for doubles/floats. See DoublesSubject for new APIs, and we'll be updating the docs on fuzzy equality soon.
    • Prefer isEqualTo instead of equals since that is a method with a fairly precise meaning in Java, and we were hijacking it. .equals() shouldn't be called on Subject implementations.
    • Multidimensional Array support in ObjectArraySubject
    • Lots of renames and deprecations.
    • SPI/API cleanup
      • marking a lot of subjects or their methods final, or noting where we can't
      • start making parts of the infrastructure more in line with the Open/Closed Principle (final methods, etc.)
      • stop storing "failure message" in the TestVerb, part 1

    New Extensions

    • An 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 MessageLite protocol buffers is also in extensions, but not released in 0.29.

    Fixes

    • Some cleanups of generics
    • Message improvements:
      • Trim some stack trace of the obvious truth frames, to make it clearer where the locus of error is. (i.e. who needs to see Subject.failComparing() in the stack trace?)
      • ThrowableSubject uses string comparision where reasonable (to take advantage of JUnit's ComparisonFailure)
      • fix BooleanSubject's handling of null in failure messaging
      • other message improvements

    Miscellaneous

    • Apply @CheckReturnValue across a wide range of methods (on by default).
      • Users are _strongly_ advised to use error-prone in their builds, to ensure that this is checked, and the compiler errors out when people fail to call the following chained methods.
    • build and continuous test system fixes
    • more recent upstream dependencies
    • full formating of the codebase using google-java-format
    • various improvements from error-prone
    • improvements to the examples
    • more flesh out some holes in the tests

    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.

    Source code(tar.gz)
    Source code(zip)
Owner
Google
Google ❤️ Open Source
Google
Never debug a test again: Detailed failure reports and hassle free assertions for Java tests - Power Asserts for Java

Scott Test Reporter for Maven and Gradle Get extremely detailed failure messages for your tests without assertion libraries, additional configuration

Dávid Csákvári 133 Nov 17, 2022
AssertJ is a library providing easy to use rich typed assertions

AssertJ - Fluent assertions for java AssertJ provides a rich and intuitive set of strongly-typed assertions to use for unit testing (with JUnit, TestN

AssertJ 2.3k Dec 30, 2022
AssertJ is a library providing easy to use rich typed assertions

AssertJ - Fluent assertions for java AssertJ provides a rich and intuitive set of strongly-typed assertions to use for unit testing (with JUnit, TestN

AssertJ 2.3k Jan 8, 2023
ShotDroid is a pentesting tool for android.

ShotDroid is a pentesting tool for android. There are 3 tools that have their respective functions, Get files from Android directory, internal and external storage, Android Keylogger + Reverse Shell and Take a webcam shot of the face from the front camera of the phone and PC.

null 179 Jan 8, 2023
A virtual Linux shell environment application for Android OS. Runs Alpine Linux in QEMU system emulator. Termux app fork.

vShell (Virtual Shell) — a successor of Termux project which provides an alternate implementation of the Linux terminal emulator for Android OS.

null 2 Feb 1, 2022
JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.

pact-jvm JVM implementation of the consumer driven contract library pact. From the Ruby Pact website: Define a pact between service consumers and prov

Pact Foundation 962 Dec 31, 2022
Roman Beskrovnyi 248 Dec 21, 2022
A Java architecture test library, to specify and assert architecture rules in plain Java

ArchUnit is a free, simple and extensible library for checking the architecture of your Java code. That is, ArchUnit can check dependencies between pa

TNG Technology Consulting GmbH 2.5k Jan 2, 2023
IntelliJ IDEA and JUnit: Writing, Finding, and Running Tests

IntelliJ IDEA and JUnit: Writing, Finding, and Running Tests ?? Webinar https://blog.jetbrains.com/idea/2021/11/live-stream-recording-intellij-idea-an

Christian Stein 11 Jul 23, 2022
Library that allows tests written in Java to follow the BDD style introduced by RSpec and Jasmine.

J8Spec J8Spec is a library that allows tests written in Java to follow the BDD style introduced by RSpec and Jasmine. More details here: j8spec.github

J8Spec 45 Feb 17, 2022
A modern testing and behavioural specification framework for Java 8

Introduction If you're a Java developer and you've seen the fluent, modern specification frameworks available in other programming languages such as s

Richard Warburton 250 Sep 12, 2022
Java (and original) version of Hamcrest

Java Hamcrest Licensed under BSD License. What is Hamcrest? Hamcrest is a library of matchers, which can be combined in to create flexible expressions

Hamcrest 2k Jan 5, 2023
Playwright is a Java library to automate Chromium, Firefox and WebKit with a single API.

Playwright is a Java library to automate Chromium, Firefox and WebKit with a single API. Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable and fast.

Microsoft 634 Jan 8, 2023
A BDD-style test runner for Java 8. Inspired by Jasmine, RSpec, and Cucumber.

Spectrum A colorful BDD-style test runner for Java Spectrum is inspired by the behavior-driven testing frameworks Jasmine and RSpec, bringing their ex

Greg Haskins 143 Nov 22, 2022
Advanced Java library for integration testing, mocking, faking, and code coverage

Codebase for JMockit 1.x releases - Documentation - Release notes How to build the project: use JDK 1.8 or newer use Maven 3.6.0 or newer; the followi

The JMockit Testing Toolkit 439 Dec 9, 2022
MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Rub

MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).

Mock-Server 4k Jan 4, 2023
Apache JMeter - An Open Source Java application designed to measure performance and load test applications

An Open Source Java application designed to measure performance and load test applications. By The Apache Software Foundation What Is It? Apache JMete

The Apache Software Foundation 6.7k Jan 1, 2023
ScalaTest is a free, open-source testing toolkit for Scala and Java programmers

ScalaTest is a free, open-source testing toolkit for Scala and Java programmers.

ScalaTest 1.1k Dec 26, 2022
Brings the popular ruby faker gem to Java and Kotlin

Data Faker This library is a modern port of java-faker, built on Java 8, with up to date libraries and several newly added Fake Generators. This libra

null 453 Jan 7, 2023