use of org.junit.runners.model.InvalidTestClassError in project junit4 by junit-team.
the class ErrorReportingRunnerTest method givenInvalidTestClassErrorAsCause.
@Test
public void givenInvalidTestClassErrorAsCause() {
final List<Failure> firedFailures = new ArrayList<Failure>();
InvalidTestClassError testClassError = new InvalidTestClassError(TestClassWithErrors.class, Arrays.asList(new Throwable("validation error 1"), new Throwable("validation error 2")));
ErrorReportingRunner sut = new ErrorReportingRunner(TestClassWithErrors.class, testClassError);
sut.run(new RunNotifier() {
@Override
public void fireTestFailure(Failure failure) {
super.fireTestFailure(failure);
firedFailures.add(failure);
}
});
assertThat(firedFailures.size(), is(1));
Throwable exception = firedFailures.get(0).getException();
assertThat(exception, instanceOf(InvalidTestClassError.class));
assertThat(((InvalidTestClassError) exception), is(testClassError));
}
Aggregations