use of org.opentest4j.TestAbortedException in project junit5 by junit-team.
the class SubclassedAssumptionsTests method assumeFalseWithBooleanTrue.
@Test
void assumeFalseWithBooleanTrue() {
TestAbortedException exception = assertThrows(TestAbortedException.class, () -> assumeFalse(true));
assertEquals("Assumption failed: assumption is not false", exception.getMessage());
}
use of org.opentest4j.TestAbortedException in project junit5 by junit-team.
the class HierarchicalTestExecutorTests method exceptionInAfterIsReportedInsteadOfEarlierTestAbortedException.
@Test
void exceptionInAfterIsReportedInsteadOfEarlierTestAbortedException() throws Exception {
var child = spy(new MyLeaf(UniqueId.root("leaf", "leaf")));
Exception exceptionInExecute = new TestAbortedException("execute");
Exception exceptionInAfter = new RuntimeException("after");
doThrow(exceptionInExecute).when(child).execute(eq(rootContext), any());
doThrow(exceptionInAfter).when(child).after(eq(rootContext));
root.addChild(child);
var inOrder = inOrder(listener, child);
executor.execute();
var childExecutionResult = ArgumentCaptor.forClass(TestExecutionResult.class);
inOrder.verify(child).execute(eq(rootContext), any());
inOrder.verify(child).after(eq(rootContext));
inOrder.verify(listener).executionFinished(eq(child), childExecutionResult.capture());
assertThat(childExecutionResult.getValue().getStatus()).isEqualTo(FAILED);
assertThat(childExecutionResult.getValue().getThrowable().get()).isSameAs(exceptionInAfter).hasSuppressedException(exceptionInExecute);
}
Aggregations