adapter.run(result);
assertEquals(exception, result.errors().nextElement().thrownException());
}
public void testNotifyResult() {
JUnit4TestAdapter adapter= new JUnit4TestAdapter(ErrorTest.class);
TestResult result= new TestResult();
final StringBuffer log= new StringBuffer();
result.addListener(new TestListener() {
public void startTest(junit.framework.Test test) {
log.append(" start " + test);
}
public void endTest(junit.framework.Test test) {
log.append(" end " + test);
}
public void addFailure(junit.framework.Test test, AssertionFailedError t) {
log.append(" failure " + test);
}
public void addError(junit.framework.Test test, Throwable t) {
log.append(" error " + test);
}
});
adapter.run(result);
String testName= String.format("error(%s)", ErrorTest.class.getName());
assertEquals(String.format(" start %s error %s end %s", testName, testName, testName), log.toString());
}