@GwtIncompatible(value="JUnit4") public final class Expect extends StandardSubjectBuilder implements org.junit.rules.TestRule
TestRule
that batches up all failures encountered during a test, and reports them all
together at the end.
Usage:
If both of the assertions above fail, the test will fail with an exception that contains information about both.@Rule public final Expect expect = Expect.create();
...
expect.that(results).containsExactly(...);
expect.that(errors).isEmpty();
To record failures for the purpose of testing that an assertion fails when it should, see
ExpectFailure
.
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement base,
org.junit.runner.Description description) |
static Expect |
create() |
static Expect |
createAndEnableStackTrace() |
boolean |
hasFailures() |
about, about, about, about, fail, fail, forCustomFailureStrategy, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, that, withMessage, withMessage
public static Expect create()
public static Expect createAndEnableStackTrace()
public boolean hasFailures()
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)
apply
in interface org.junit.rules.TestRule
Copyright © 2017. All rights reserved.