class AssertTimeoutPreemptively
extends java.lang.Object
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.| Modifier and Type | Class and Description |
|---|---|
private static class |
AssertTimeoutPreemptively.ExecutionTimeoutException |
private static class |
AssertTimeoutPreemptively.TimeoutThreadFactory
The thread factory used for preemptive timeout.
|
| Constructor and Description |
|---|
AssertTimeoutPreemptively() |
| Modifier and Type | Method and Description |
|---|---|
(package private) static void |
assertTimeoutPreemptively(java.time.Duration timeout,
Executable executable) |
(package private) static void |
assertTimeoutPreemptively(java.time.Duration timeout,
Executable executable,
java.lang.String message) |
(package private) static void |
assertTimeoutPreemptively(java.time.Duration timeout,
Executable executable,
java.util.function.Supplier<java.lang.String> messageSupplier) |
(package private) static <T> T |
assertTimeoutPreemptively(java.time.Duration timeout,
ThrowingSupplier<T> supplier) |
(package private) static <T> T |
assertTimeoutPreemptively(java.time.Duration timeout,
ThrowingSupplier<T> supplier,
java.lang.String message) |
(package private) static <T> T |
assertTimeoutPreemptively(java.time.Duration timeout,
ThrowingSupplier<T> supplier,
java.util.function.Supplier<java.lang.String> messageSupplier) |
(package private) static <T,E extends java.lang.Throwable> |
assertTimeoutPreemptively(java.time.Duration timeout,
ThrowingSupplier<T> supplier,
java.util.function.Supplier<java.lang.String> messageSupplier,
Assertions.TimeoutFailureFactory<E> failureFactory) |
private static org.opentest4j.AssertionFailedError |
createAssertionFailure(java.time.Duration timeout,
java.util.function.Supplier<java.lang.String> messageSupplier,
java.lang.Throwable cause) |
private static <T,E extends java.lang.Throwable> |
resolveFutureAndHandleException(java.util.concurrent.Future<T> future,
java.time.Duration timeout,
java.util.function.Supplier<java.lang.String> messageSupplier,
java.util.function.Supplier<java.lang.Thread> threadSupplier,
Assertions.TimeoutFailureFactory<E> failureFactory) |
private static <T> java.util.concurrent.Future<T> |
submitTask(ThrowingSupplier<T> supplier,
java.util.concurrent.atomic.AtomicReference<java.lang.Thread> threadReference,
java.util.concurrent.ExecutorService executorService) |
static void assertTimeoutPreemptively(java.time.Duration timeout,
Executable executable)
static void assertTimeoutPreemptively(java.time.Duration timeout,
Executable executable,
java.lang.String message)
static void assertTimeoutPreemptively(java.time.Duration timeout,
Executable executable,
java.util.function.Supplier<java.lang.String> messageSupplier)
static <T> T assertTimeoutPreemptively(java.time.Duration timeout,
ThrowingSupplier<T> supplier)
static <T> T assertTimeoutPreemptively(java.time.Duration timeout,
ThrowingSupplier<T> supplier,
java.lang.String message)
static <T> T assertTimeoutPreemptively(java.time.Duration timeout,
ThrowingSupplier<T> supplier,
java.util.function.Supplier<java.lang.String> messageSupplier)
static <T,E extends java.lang.Throwable> T assertTimeoutPreemptively(java.time.Duration timeout,
ThrowingSupplier<T> supplier,
java.util.function.Supplier<java.lang.String> messageSupplier,
Assertions.TimeoutFailureFactory<E> failureFactory)
throws E extends java.lang.Throwable
E extends java.lang.Throwableprivate static <T> java.util.concurrent.Future<T> submitTask(ThrowingSupplier<T> supplier, java.util.concurrent.atomic.AtomicReference<java.lang.Thread> threadReference, java.util.concurrent.ExecutorService executorService)
private static <T,E extends java.lang.Throwable> T resolveFutureAndHandleException(java.util.concurrent.Future<T> future,
java.time.Duration timeout,
java.util.function.Supplier<java.lang.String> messageSupplier,
java.util.function.Supplier<java.lang.Thread> threadSupplier,
Assertions.TimeoutFailureFactory<E> failureFactory)
throws E extends java.lang.Throwable
E extends java.lang.Throwableprivate static org.opentest4j.AssertionFailedError createAssertionFailure(java.time.Duration timeout,
java.util.function.Supplier<java.lang.String> messageSupplier,
java.lang.Throwable cause)