use of org.opentest4j.AssertionFailedError in project junit5 by junit-team.
the class AssertTimeoutAssertionsTests method assertTimeoutPreemptivelyWithMessageSupplierForExecutableThatCompletesAfterTheTimeout.
@Test
void assertTimeoutPreemptivelyWithMessageSupplierForExecutableThatCompletesAfterTheTimeout() {
AssertionFailedError error = assertThrows(AssertionFailedError.class, () -> assertTimeoutPreemptively(PREEMPTIVE_TIMEOUT, this::waitForInterrupt, () -> "Tempus" + " " + "Fugit"));
assertMessageEquals(error, "Tempus Fugit ==> execution timed out after " + PREEMPTIVE_TIMEOUT.toMillis() + " ms");
assertMessageStartsWith(error.getCause(), "Execution timed out in ");
assertStackTraceContains(error.getCause().getStackTrace(), "CountDownLatch", "await");
}
use of org.opentest4j.AssertionFailedError in project junit5 by junit-team.
the class AssertTimeoutAssertionsTests method assertTimeoutWithMessageForSupplierThatCompletesAfterTheTimeout.
@Test
void assertTimeoutWithMessageForSupplierThatCompletesAfterTheTimeout() {
AssertionFailedError error = assertThrows(AssertionFailedError.class, () -> {
assertTimeout(ofMillis(10), () -> {
nap();
return "Tempus Fugit";
}, "Tempus Fugit");
});
assertMessageStartsWith(error, "Tempus Fugit ==> execution exceeded timeout of 10 ms by");
}
use of org.opentest4j.AssertionFailedError in project junit5 by junit-team.
the class AssertTimeoutAssertionsTests method assertTimeoutForSupplierThatThrowsAnAssertionFailedError.
@Test
void assertTimeoutForSupplierThatThrowsAnAssertionFailedError() {
AssertionFailedError exception = assertThrows(AssertionFailedError.class, () -> {
assertTimeout(ofMillis(500), () -> {
fail("enigma");
return "Tempus Fugit";
});
});
assertMessageEquals(exception, "enigma");
}
use of org.opentest4j.AssertionFailedError in project junit5 by junit-team.
the class AssertTimeoutAssertionsTests method assertTimeoutForExecutableThatCompletesAfterTheTimeout.
@Test
void assertTimeoutForExecutableThatCompletesAfterTheTimeout() {
AssertionFailedError error = assertThrows(AssertionFailedError.class, () -> assertTimeout(ofMillis(10), this::nap));
assertMessageStartsWith(error, "execution exceeded timeout of 10 ms by");
}
use of org.opentest4j.AssertionFailedError in project junit5 by junit-team.
the class AssertTimeoutAssertionsTests method assertTimeoutWithMessageForExecutableThatCompletesAfterTheTimeout.
@Test
void assertTimeoutWithMessageForExecutableThatCompletesAfterTheTimeout() {
AssertionFailedError error = assertThrows(AssertionFailedError.class, () -> assertTimeout(ofMillis(10), this::nap, "Tempus Fugit"));
assertMessageStartsWith(error, "Tempus Fugit ==> execution exceeded timeout of 10 ms by");
}
Aggregations