java.lang.Object
org.junit.jupiter.api.AssertTimeoutPreemptively
AssertTimeout
is a collection of utility methods that support asserting
the execution of the code under test did not take longer than the timeout duration
using a preemptive approach.- Since:
- 5.9.1
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
The thread factory used for preemptive timeout. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static void
assertTimeoutPreemptively
(Duration timeout, Executable executable) (package private) static void
assertTimeoutPreemptively
(Duration timeout, Executable executable, String message) (package private) static void
assertTimeoutPreemptively
(Duration timeout, Executable executable, Supplier<String> messageSupplier) (package private) static <T> T
assertTimeoutPreemptively
(Duration timeout, ThrowingSupplier<T> supplier) (package private) static <T> T
assertTimeoutPreemptively
(Duration timeout, ThrowingSupplier<T> supplier, String message) (package private) static <T> T
assertTimeoutPreemptively
(Duration timeout, ThrowingSupplier<T> supplier, Supplier<String> messageSupplier) (package private) static <T,
E extends Throwable>
TassertTimeoutPreemptively
(Duration timeout, ThrowingSupplier<T> supplier, Supplier<String> messageSupplier, Assertions.TimeoutFailureFactory<E> failureFactory) private static org.opentest4j.AssertionFailedError
createAssertionFailure
(Duration timeout, Supplier<String> messageSupplier, Throwable cause) private static <T,
E extends Throwable>
TresolveFutureAndHandleException
(Future<T> future, Duration timeout, Supplier<String> messageSupplier, Supplier<Thread> threadSupplier, Assertions.TimeoutFailureFactory<E> failureFactory) private static <T> Future<T>
submitTask
(ThrowingSupplier<T> supplier, AtomicReference<Thread> threadReference, ExecutorService executorService)
-
Constructor Details
-
AssertTimeoutPreemptively
AssertTimeoutPreemptively()
-
-
Method Details
-
assertTimeoutPreemptively
-
assertTimeoutPreemptively
-
assertTimeoutPreemptively
static void assertTimeoutPreemptively(Duration timeout, Executable executable, Supplier<String> messageSupplier) -
assertTimeoutPreemptively
-
assertTimeoutPreemptively
static <T> T assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier, String message) -
assertTimeoutPreemptively
static <T> T assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier, Supplier<String> messageSupplier) -
assertTimeoutPreemptively
static <T,E extends Throwable> T assertTimeoutPreemptively(Duration timeout, ThrowingSupplier<T> supplier, Supplier<String> messageSupplier, Assertions.TimeoutFailureFactory<E> failureFactory) throws E - Throws:
E extends Throwable
-
submitTask
private static <T> Future<T> submitTask(ThrowingSupplier<T> supplier, AtomicReference<Thread> threadReference, ExecutorService executorService) -
resolveFutureAndHandleException
private static <T,E extends Throwable> T resolveFutureAndHandleException(Future<T> future, Duration timeout, Supplier<String> messageSupplier, Supplier<Thread> threadSupplier, Assertions.TimeoutFailureFactory<E> failureFactory) throws E - Throws:
E extends Throwable
-
createAssertionFailure
-