| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.junit.rules.Verifier
org.junit.rules.ErrorCollector
public class 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.
        }
 }
 
| Constructor Summary | |
|---|---|
ErrorCollector()
 | 
|
| Method Summary | ||
|---|---|---|
 void | 
addError(Throwable error)
Adds a Throwable to the table.  | 
|
 Object | 
checkSucceeds(Callable<Object> callable)
Adds to the table the exception, if any, thrown from callable. | 
|
 | 
checkThat(T value,
          Matcher<T> matcher)
Adds a failure to the table if matcher does not match value. | 
|
protected  void | 
verify()
Override this to add verification logic.  | 
|
| Methods inherited from class org.junit.rules.Verifier | 
|---|
apply | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public ErrorCollector()
| Method Detail | 
|---|
protected void verify()
               throws Throwable
Verifier
verify in class VerifierThrowablepublic void addError(Throwable error)
public <T> void checkThat(T value,
                          Matcher<T> matcher)
matcher does not match value.  
 Execution continues, but the test will fail at the end if the match fails.
public Object checkSucceeds(Callable<Object> callable)
callable.  
 Execution continues, but the test will fail at the end if callable
 threw an exception.
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||