java.lang.Object | ||
↳ | org.junit.rules.Verifier | |
↳ | org.junit.rules.ErrorCollector |
The ErrorCollector rule allows execution of a test to continue after the first problem is found (for example, to collect _all_ the incorrect rows in a table, and report them all at once):
public static class UsesErrorCollectorTwice { @Rule public ErrorCollector collector= new ErrorCollector(); @Test public void example() { collector.addError(new Throwable("first thing went wrong")); collector.addError(new Throwable("second thing went wrong")); collector.checkThat(getResult(), not(containsString("ERROR!"))); // all lines will run, and then a combined failure logged at the end. } }
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds a Throwable to the table.
| |||||||||||
Adds to the table the exception, if any, thrown from
callable . | |||||||||||
Adds a failure to the table if
matcher does not match value . |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Override this to add verification logic.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.junit.rules.Verifier
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.junit.rules.MethodRule
|
Adds a Throwable to the table. Execution continues, but the test will fail at the end.
Adds to the table the exception, if any, thrown from callable
.
Execution continues, but the test will fail at the end if callable
threw an exception.
Adds a failure to the table if matcher
does not match value
.
Execution continues, but the test will fail at the end if the match fails.
Override this to add verification logic. Overrides should throw an exception to indicate that verification failed.
Throwable |
---|