use of org.opentest4j.TestAbortedException in project cucumber-jvm by cucumber.
the class RerunFormatterTest method should_leave_report_empty_when_exit_code_is_zero.
@Test
void should_leave_report_empty_when_exit_code_is_zero() {
Feature feature = TestFeatureParser.parse("classpath:path/test.feature", "" + "Feature: feature name\n" + " Scenario: passed scenario\n" + " Given passed step\n" + " Scenario: skipped scenario\n" + " Given skipped step\n");
ByteArrayOutputStream out = new ByteArrayOutputStream();
Runtime.builder().withFeatureSupplier(new StubFeatureSupplier(feature)).withAdditionalPlugins(new RerunFormatter(out)).withBackendSupplier(new StubBackendSupplier(new StubStepDefinition("passed step"), new StubStepDefinition("skipped step", new TestAbortedException()))).build().run();
assertThat(out, isBytesEqualTo(""));
}
use of org.opentest4j.TestAbortedException in project netty by netty.
the class EpollSocketChannelConfigTest method testRandomTcpNotSentLowAt.
@Test
public void testRandomTcpNotSentLowAt() {
final long expected = randLong(0, 0xFFFFFFFFL);
final long actual;
try {
ch.config().setTcpNotSentLowAt(expected);
actual = ch.config().getTcpNotSentLowAt();
} catch (RuntimeException e) {
throw new TestAbortedException("assumeNoException", e);
}
assertEquals(expected, actual);
}
use of org.opentest4j.TestAbortedException in project GDSC-SMLM by aherbert.
the class HelpUrlsTest method canReachUrls.
/**
* Connects to the online documentation, downloads the pages and tests the links and anchors are
* reachable.
*
* @throws TestAbortedException the test aborted exception
*/
@Test
void canReachUrls() throws TestAbortedException {
// Test we are online
Assumptions.assumeTrue(testInternetAvailable());
// Iterate all the URLs and test we can connect.
// URLs may have anchor tags so build the pages and all their anchors.
final HashMap<String, Set<String>> pages = new HashMap<>();
HelpUrls.forEach((k, v) -> {
// Strip anchor tags
final int index = v.indexOf('#');
if (index < 0) {
pages.computeIfAbsent(v, key -> new HashSet<>());
} else {
final String page = v.substring(0, index);
final String anchor = v.substring(index + 1);
pages.computeIfAbsent(page, key -> new HashSet<>()).add(anchor);
}
});
// Obtain each page. Then download the page html and check the named anchor tag exists.
pages.forEach((page, anchors) -> {
// Use Jsoup library to get the HTML as a document...
final Document doc = connectToUrl(page);
anchors.forEach(anchor -> {
final Elements e = doc.select("a[href=#" + anchor + "]");
Assertions.assertTrue(e.size() > 0, () -> "Missing " + page + "#" + anchor);
});
});
}
use of org.opentest4j.TestAbortedException in project junit5 by junit-team.
the class StandaloneTests method testOnJava8.
@Test
@Order(3)
void testOnJava8() throws IOException {
var result = //
Request.builder().setTool(//
new Java()).setJavaHome(//
Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)).setProject(//
"standalone").addArguments(//
"--show-version").addArguments(//
"-enableassertions").addArguments(//
"-Djava.util.logging.config.file=logging.properties").addArguments("-jar", //
MavenRepo.jar("junit-platform-console-standalone")).addArguments(//
"--scan-class-path").addArguments(//
"--disable-banner").addArguments("--include-classname", //
"standalone.*").addArguments("--classpath", "bin").build().run(false);
assertEquals(1, result.getExitCode(), String.join("\n", result.getOutputLines("out")));
var workspace = Request.WORKSPACE.resolve("standalone");
var expectedOutLines = Files.readAllLines(workspace.resolve("expected-out.txt"));
var expectedErrLines = Files.readAllLines(workspace.resolve("expected-err.txt"));
assertLinesMatch(expectedOutLines, result.getOutputLines("out"));
assertLinesMatch(expectedErrLines, result.getOutputLines("err"));
var jupiterVersion = Helper.version("junit-jupiter-engine");
var vintageVersion = Helper.version("junit-vintage-engine");
assertTrue(result.getOutput("err").contains("junit-jupiter" + " (group ID: org.junit.jupiter, artifact ID: junit-jupiter-engine, version: " + jupiterVersion));
assertTrue(result.getOutput("err").contains("junit-vintage" + " (group ID: org.junit.vintage, artifact ID: junit-vintage-engine, version: " + vintageVersion));
}
use of org.opentest4j.TestAbortedException in project junit5 by junit-team.
the class ExceptionHandlingTests method failureInAfterAllTakesPrecedenceOverTestAbortedExceptionInBeforeAll.
@Test
void failureInAfterAllTakesPrecedenceOverTestAbortedExceptionInBeforeAll() {
FailureTestCase.exceptionToThrowInBeforeAll = Optional.of(new TestAbortedException("aborted"));
FailureTestCase.exceptionToThrowInAfterAll = Optional.of(new IOException("checked"));
EngineExecutionResults executionResults = executeTests(selectMethod(FailureTestCase.class, "succeedingTest"));
//
executionResults.allEvents().assertEventsMatchExactly(//
event(engine(), started()), //
event(container(FailureTestCase.class), started()), event(container(FailureTestCase.class), finishedWithFailure(instanceOf(IOException.class), message("checked"), //
suppressed(0, instanceOf(TestAbortedException.class), message("aborted")))), event(engine(), finishedSuccessfully()));
}
Aggregations