/** * Asserts that a {@link Deferred}, when it becomes available, * will eventually satisfy the specified {@link Matcher}. * * @param <T> the type of value produced by the {@link Deferred} * * @param deferred the {@link Deferred} * @param matcher the {@link Matcher} * * @throws AssertionError if the assertion fails */ public static <T> void assertThat(Deferred<T> deferred, Matcher<?> matcher) throws AssertionError { assertThat(null, deferred, matcher); }
/** * Asserts that a {@link Deferred}, when it becomes available, * will eventually (after the specified amount of time) satisfy the * specified {@link Matcher}. * * @param <T> the type of value produced by the {@link Deferred} * * @param deferred the {@link Deferred} * @param matcher the {@link Matcher} * @param totalRetryDuration the maximum duration for retrying * @param totalRetryDurationUnits the {@link TimeUnit}s for the duration * * @throws AssertionError if the assertion fails */ public static <T> void assertThat(Deferred<T> deferred, Matcher<?> matcher, long totalRetryDuration, TimeUnit totalRetryDurationUnits) throws AssertionError { assertThat(null, deferred, matcher, totalRetryDuration, totalRetryDurationUnits); }
/** * Asserts that a {@link Deferred}, when it becomes available, * will eventually (after the default amount of time) satisfy the * specified {@link Matcher}. * * @param <T> the type of value produced by the {@link Deferred} * * @param message the message for the AssertionError (<code>null</code> ok) * @param deferred the {@link Deferred} * @param matcher the {@link Matcher} * * @throws AssertionError if the assertion fails */ public static <T> void assertThat(String message, Deferred<T> deferred, Matcher<?> matcher) throws AssertionError { assertThat(message, deferred, matcher, DeferredHelper.ORACLETOOLS_DEFERRED_RETRY_TIMEOUT_SECS, TimeUnit.SECONDS); }
/** * Asserts that a value will eventually satisfy the specified {@link Matcher}. * <p> * Should the value be the result of a call to {@link DeferredHelper#invoking(Deferred)} * the result is unwrapped into a {@link Deferred} that is then used for the assert. * * @param <T> the type of value produced by the {@link Deferred} * * @param message the message for the AssertionError (<code>null</code> ok) * @param value the value * @param matcher the {@link Matcher} * * @throws AssertionError if the assertion fails */ public static <T> void assertThat(String message, T value, Matcher<?> matcher) throws AssertionError { assertThat(message, eventually(value), matcher); }
/** * Asserts that the specified {@link Callable} submitted to the {@link JavaApplication} * will eventually match the specified matcher. * * @param <T> the type of value produced by the {@link Deferred} * * @param application the {@link JavaApplication} to which the {@link Callable} will be submitted * @param callable the {@link Callable} * @param matcher the {@link Matcher} representing the desire condition to match * * @throws AssertionError if the assertion fails */ public static <T> void assertThat(JavaApplication<?> application, Callable<T> callable, Matcher<?> matcher) throws AssertionError { assertThat(new DeferredRemoteExecution<T>(application, callable), matcher); } }
/** * Asserts that a value will eventually satisfy the specified {@link Matcher}. * <p> * Should the value be the result of a call to {@link DeferredHelper#invoking(Deferred)} * the result is unwrapped into a {@link Deferred} that is then used for the assert. * * @param <T> the type of value produced by the {@link Deferred} * * @param value the value * @param matcher the {@link Matcher} * * @throws AssertionError if the assertion fails */ public static <T> void assertThat(T value, Matcher<?> matcher) throws AssertionError { assertThat(null, eventually(value), matcher); }