use of org.opentest4j.AssertionFailedError in project junit5 by junit-team.
the class AssertTimeoutAssertionsTests method assertTimeoutPreemptivelyForExecutableThatCompletesAfterTheTimeout.
@Test
void assertTimeoutPreemptivelyForExecutableThatCompletesAfterTheTimeout() {
AssertionFailedError error = assertThrows(AssertionFailedError.class, () -> assertTimeoutPreemptively(PREEMPTIVE_TIMEOUT, this::waitForInterrupt));
assertMessageEquals(error, "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 assertTimeoutForSupplierThatCompletesAfterTheTimeout.
@Test
void assertTimeoutForSupplierThatCompletesAfterTheTimeout() {
AssertionFailedError error = assertThrows(AssertionFailedError.class, () -> {
assertTimeout(ofMillis(10), () -> {
nap();
return "Tempus Fugit";
});
});
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");
}
use of org.opentest4j.AssertionFailedError in project junit5 by junit-team.
the class AssertTimeoutAssertionsTests method assertTimeoutPreemptivelyWithMessageSupplierForSupplierThatCompletesAfterTheTimeout.
@Test
void assertTimeoutPreemptivelyWithMessageSupplierForSupplierThatCompletesAfterTheTimeout() {
AssertionFailedError error = assertThrows(AssertionFailedError.class, () -> {
assertTimeoutPreemptively(PREEMPTIVE_TIMEOUT, () -> {
waitForInterrupt();
return "Tempus Fugit";
}, () -> "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");
}
Aggregations