use of org.opentest4j.TestAbortedException in project netty by netty.
the class KQueueSocketChannelConfigTest method testRandomSndLowAt.
@Test
public void testRandomSndLowAt() {
final int expected = Math.min(BSD_SND_LOW_AT_MAX, Math.abs(rand.nextInt()));
final int actual;
try {
ch.config().setSndLowAt(expected);
actual = ch.config().getSndLowAt();
} catch (RuntimeException e) {
throw new TestAbortedException("assumeNoException", e);
}
assertEquals(expected, actual);
}
use of org.opentest4j.TestAbortedException in project spock by spockframework.
the class PendingFeatureBaseInterceptor method testAborted.
protected TestAbortedException testAborted(StackTraceElement[] stackTrace) {
TestAbortedException testAbortedException = new TestAbortedException("Feature not yet implemented correctly." + ("".equals(reason) ? "" : " Reason: " + reason));
testAbortedException.setStackTrace(stackTrace);
return testAbortedException;
}
use of org.opentest4j.TestAbortedException in project zipkin by openzipkin.
the class KafkaExtension method prepareTopics.
void prepareTopics(String topics, int partitions) {
Properties config = new Properties();
config.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServer());
List<NewTopic> newTopics = new ArrayList<>();
for (String topic : topics.split(",")) {
if ("".equals(topic))
continue;
newTopics.add(new NewTopic(topic, partitions, (short) 1));
}
try (AdminClient adminClient = AdminClient.create(config)) {
adminClient.createTopics(newTopics).all().get();
} catch (InterruptedException | ExecutionException e) {
if (e.getCause() != null && e.getCause() instanceof TopicExistsException)
return;
throw new TestAbortedException("Topics could not be created " + newTopics + ": " + e.getMessage(), e);
}
}
use of org.opentest4j.TestAbortedException in project junit5 by junit-team.
the class HierarchicalTestExecutorTests method abortInContainerBeforeAll.
@Test
void abortInContainerBeforeAll() throws Exception {
MyContainer child = spy(new MyContainer(UniqueId.root("container", "child container")));
root.addChild(child);
TestAbortedException anAbortedException = new TestAbortedException("in BeforeAll");
when(root.before(rootContext)).thenThrow(anAbortedException);
InOrder inOrder = inOrder(listener, root, child);
executor.execute();
ArgumentCaptor<TestExecutionResult> rootExecutionResult = ArgumentCaptor.forClass(TestExecutionResult.class);
inOrder.verify(root).prepare(rootContext);
inOrder.verify(root).shouldBeSkipped(rootContext);
inOrder.verify(listener).executionStarted(root);
inOrder.verify(root).before(rootContext);
inOrder.verify(root).after(rootContext);
inOrder.verify(listener).executionFinished(eq(root), rootExecutionResult.capture());
assertThat(rootExecutionResult.getValue().getStatus()).isEqualTo(ABORTED);
assertThat(rootExecutionResult.getValue().getThrowable()).containsSame(anAbortedException);
verifyNoMoreInteractions(child);
}
use of org.opentest4j.TestAbortedException in project junit5 by junit-team.
the class HierarchicalTestExecutorTests method abortInLeafExecute.
@Test
void abortInLeafExecute() throws Exception {
MyLeaf child = spy(new MyLeaf(UniqueId.root("leaf", "leaf")));
TestAbortedException anAbortedException = new TestAbortedException("in test");
when(child.execute(eq(rootContext), any())).thenThrow(anAbortedException);
root.addChild(child);
InOrder inOrder = inOrder(listener, root, child);
executor.execute();
ArgumentCaptor<TestExecutionResult> childExecutionResult = ArgumentCaptor.forClass(TestExecutionResult.class);
inOrder.verify(listener).executionStarted(root);
inOrder.verify(root).before(rootContext);
inOrder.verify(listener).executionStarted(child);
inOrder.verify(child).execute(eq(rootContext), any());
inOrder.verify(listener).executionFinished(eq(child), childExecutionResult.capture());
inOrder.verify(root).after(rootContext);
inOrder.verify(listener).executionFinished(eq(root), any(TestExecutionResult.class));
assertThat(childExecutionResult.getValue().getStatus()).isEqualTo(ABORTED);
assertThat(childExecutionResult.getValue().getThrowable()).containsSame(anAbortedException);
}
Aggregations