@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();
Modifier and Type | Class and Description |
---|---|
static class |
Expect.ExpectationGatherer
Deprecated.
To provide your own failure handling, use
StandardSubjectBuilder.forCustomFailureStrategy(new AbstractFailureStrategy() { ... })
instead of Expect.create(new ExpectationGatherer() { ... }) . Or, if you're testing
that assertions on a custom Subject fail (using ExpectationGatherer to
capture the failures), use ExpectFailure . |
AbstractVerb.DelegatedVerb<S extends Subject<S,T>,T>
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 |
create(Expect.ExpectationGatherer gatherer)
Deprecated.
To provide your own failure handling, use
StandardSubjectBuilder.forCustomFailureStrategy(new AbstractFailureStrategy() { ... })
instead of Expect.create(new ExpectationGatherer() { ... }) . |
static Expect |
createAndEnableStackTrace() |
boolean |
hasFailures() |
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
about, getFailureStrategy
getFailureMessage, hasFailureMessage
public static Expect create()
@Deprecated public static Expect create(Expect.ExpectationGatherer gatherer)
StandardSubjectBuilder.forCustomFailureStrategy(new AbstractFailureStrategy() { ... })
instead of Expect.create(new ExpectationGatherer() { ... })
.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.