use of cucumber.api.PendingException in project cucumber-jvm by cucumber.
the class JUnitReporterTest method result_with_pending_step_strict.
@Test
public void result_with_pending_step_strict() {
createStrictReporter();
createDefaultRunNotifier();
Result result = mock(Result.class);
when(result.getError()).thenReturn(new PendingException());
EachTestNotifier stepNotifier = mock(EachTestNotifier.class);
jUnitReporter.stepNotifier = stepNotifier;
EachTestNotifier executionUnitNotifier = mock(EachTestNotifier.class);
jUnitReporter.executionUnitNotifier = executionUnitNotifier;
jUnitReporter.result(result);
verify(stepNotifier, times(1)).fireTestStarted();
verify(stepNotifier, times(1)).fireTestFinished();
verifyAddFailureWithPendingException(stepNotifier);
verifyAddFailureWithPendingException(executionUnitNotifier);
verify(stepNotifier, times(0)).fireTestIgnored();
}
use of cucumber.api.PendingException in project cucumber-jvm by cucumber.
the class JUnitReporterTest method result_with_pending_step_non_strict.
@Test
public void result_with_pending_step_non_strict() {
createNonStrictReporter();
Result result = mock(Result.class);
when(result.getError()).thenReturn(new PendingException());
EachTestNotifier stepNotifier = mock(EachTestNotifier.class);
jUnitReporter.stepNotifier = stepNotifier;
jUnitReporter.result(result);
verify(stepNotifier, times(0)).fireTestStarted();
verify(stepNotifier, times(0)).fireTestFinished();
verify(stepNotifier, times(0)).addFailure(Matchers.<Throwable>any(Throwable.class));
verify(stepNotifier).fireTestIgnored();
}
use of cucumber.api.PendingException in project cucumber-jvm by cucumber.
the class JUnitReporterTest method failed_step_and_after_with_pending_exception_non_strict.
@Test
public void failed_step_and_after_with_pending_exception_non_strict() {
createNonStrictReporter();
createDefaultRunNotifier();
Result stepResult = mock(Result.class);
Throwable exception = mock(Throwable.class);
when(stepResult.getError()).thenReturn(exception);
Result hookResult = mock(Result.class);
Match match = mock(Match.class);
when(hookResult.getStatus()).thenReturn("Pending");
when(hookResult.getError()).thenReturn(new PendingException());
EachTestNotifier executionUnitNotifier = mock(EachTestNotifier.class);
jUnitReporter.executionUnitNotifier = executionUnitNotifier;
jUnitReporter.result(stepResult);
jUnitReporter.after(match, hookResult);
jUnitReporter.finishExecutionUnit();
verify(executionUnitNotifier, times(0)).fireTestIgnored();
}
use of cucumber.api.PendingException in project cucumber-jvm by cucumber.
the class JUnitReporter method addFailure.
private void addFailure(Result result) {
Throwable error = result.getError();
if (error == null) {
error = new PendingException();
}
failedStep = true;
stepNotifier.addFailure(error);
executionUnitNotifier.addFailure(error);
}
Aggregations