use of io.cucumber.plugin.event.Status in project cucumber-jvm by cucumber.
the class TestCaseResultObserver method assertTestCasePassed.
public void assertTestCasePassed(Supplier<Throwable> testCaseSkipped, Function<Throwable, Throwable> testCaseSkippedWithException, Function<List<Suggestion>, Throwable> testCaseWasUndefined, Function<Throwable, Throwable> testCaseWasPending) {
Status status = result.getStatus();
if (status.is(PASSED)) {
return;
}
Throwable error = result.getError();
if (status.is(SKIPPED) && error == null) {
Throwable throwable = testCaseSkipped.get();
throw new TestCaseFailed(throwable);
} else if (status.is(SKIPPED) && error != null) {
Throwable throwable = testCaseSkippedWithException.apply(error);
throw new TestCaseFailed(throwable);
} else if (status.is(UNDEFINED)) {
Throwable throwable = testCaseWasUndefined.apply(suggestions);
throw new TestCaseFailed(throwable);
} else if (status.is(PENDING)) {
Throwable throwable = testCaseWasPending.apply(error);
throw new TestCaseFailed(throwable);
}
requireNonNull(error, "result.error=null while result.status=" + result.getStatus());
throw new TestCaseFailed(error);
}
Aggregations