public final class BlockingTestUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
await(Completable source,
long timeout,
java.util.concurrent.TimeUnit timeoutUnit)
Awaits termination of the passed
Completable by blocking the calling thread. |
static <T> java.util.List<T> |
await(Publisher<T> source,
long timeout,
java.util.concurrent.TimeUnit timeoutUnit)
Awaits termination of the passed
Publisher by blocking the calling thread. |
static <T> T |
await(Single<T> source,
long timeout,
java.util.concurrent.TimeUnit timeoutUnit)
Awaits termination of the passed
Single by blocking the calling thread. |
static void |
awaitIndefinitely(Completable source)
Awaits termination of the passed
Completable by blocking the calling thread. |
static <T> java.util.List<T> |
awaitIndefinitely(Publisher<T> source)
Awaits termination of the passed
Publisher by blocking the calling thread. |
static <T> T |
awaitIndefinitely(Single<T> source)
Awaits termination of the passed
Single by blocking the calling thread. |
static <T> java.util.List<T> |
awaitIndefinitelyNonNull(Publisher<T> source)
Awaits termination of the passed
Publisher by blocking the calling thread. |
static <T> T |
awaitIndefinitelyNonNull(Single<T> source)
Awaits termination of the passed
Single by blocking the calling thread. |
static void |
awaitIndefinitelyUnchecked(Completable source)
Awaits termination of the passed
Completable by blocking the calling thread. |
static <T> java.util.List<T> |
awaitNonNull(Publisher<T> source,
long timeout,
java.util.concurrent.TimeUnit timeoutUnit)
Awaits termination of the passed
Publisher by blocking the calling thread. |
static <T> T |
awaitNonNull(Single<T> source,
long timeout,
java.util.concurrent.TimeUnit timeoutUnit)
Awaits termination of the passed
Single by blocking the calling thread. |
@Nullable public static <T> java.util.List<T> awaitIndefinitely(Publisher<T> source) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Publisher
by blocking the calling thread.T
- Type of items produced by the Publisher
.source
- to await for.List
of all elements emitted by the Publisher
, iff it terminated successfully.java.util.concurrent.ExecutionException
- if the passed Publisher
terminates with a failure.java.lang.InterruptedException
- if the thread was interrupted while waiting for termination.public static <T> java.util.List<T> awaitIndefinitelyNonNull(Publisher<T> source) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Publisher
by blocking the calling thread.T
- Type of items produced by the Publisher
.source
- to await for.List
of all elements emitted by the Publisher
, iff it terminated successfully.java.util.concurrent.ExecutionException
- if the passed Publisher
terminates with a failure, or if the result of
awaitIndefinitely(Publisher)
is null
.java.lang.InterruptedException
- if the thread was interrupted while waiting for termination.awaitIndefinitely(Publisher)
@Nullable public static <T> java.util.List<T> await(Publisher<T> source, long timeout, java.util.concurrent.TimeUnit timeoutUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException
Publisher
by blocking the calling thread.T
- Type of items produced by the Publisher
.source
- to await for.timeout
- maximum time to wait for termination.timeoutUnit
- TimeUnit
for timeout.List
of all elements emitted by the Publisher
, iff it terminated successfully.java.util.concurrent.ExecutionException
- if the passed Publisher
terminates with a failure.java.lang.InterruptedException
- if the thread was interrupted while waiting for termination.java.util.concurrent.TimeoutException
- If the Publisher
isn't terminated after waiting for the passed timeout
duration.public static <T> java.util.List<T> awaitNonNull(Publisher<T> source, long timeout, java.util.concurrent.TimeUnit timeoutUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException
Publisher
by blocking the calling thread.T
- Type of items produced by the Publisher
.source
- to await for.timeout
- maximum time to wait for termination.timeoutUnit
- TimeUnit
for timeout.List
of all elements emitted by the Publisher
, iff it terminated successfully.java.util.concurrent.ExecutionException
- if the passed Publisher
terminates with a failure, or if the result of
await(Publisher, long, TimeUnit)
is null
.java.lang.InterruptedException
- if the thread was interrupted while waiting for termination.java.util.concurrent.TimeoutException
- If the Publisher
isn't terminated after waiting for the passed timeout
duration.await(Publisher, long, TimeUnit)
@Nullable public static <T> T awaitIndefinitely(Single<T> source) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Single
by blocking the calling thread.T
- Type of the result of Single
.source
- to await for.Single
. null
if the source
is of type Void
.java.util.concurrent.ExecutionException
- if the passed Publisher
terminates with a failure.java.lang.InterruptedException
- if the thread was interrupted while waiting for termination.public static <T> T awaitIndefinitelyNonNull(Single<T> source) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Single
by blocking the calling thread.T
- Type of the result of Single
.source
- to await for.Single
. null
if the source
is of type Void
.java.util.concurrent.ExecutionException
- if the passed Publisher
terminates with a failure, or if the result of
awaitIndefinitely(Single)
is null
.java.lang.InterruptedException
- if the thread was interrupted while waiting for termination.awaitIndefinitely(Single)
@Nullable public static <T> T await(Single<T> source, long timeout, java.util.concurrent.TimeUnit timeoutUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException
Single
by blocking the calling thread.T
- Type of the result of Single
.source
- to await for.timeout
- maximum time to wait for termination.timeoutUnit
- TimeUnit
for timeout.Single
. null
if the source
is of type Void
.java.util.concurrent.ExecutionException
- if the passed Publisher
terminates with a failure.java.lang.InterruptedException
- if the thread was interrupted while waiting for termination.java.util.concurrent.TimeoutException
- If the result isn't available after waiting for the passed timeout
duration.public static <T> T awaitNonNull(Single<T> source, long timeout, java.util.concurrent.TimeUnit timeoutUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException
Single
by blocking the calling thread.T
- Type of the result of Single
.source
- to await for.timeout
- maximum time to wait for termination.timeoutUnit
- TimeUnit
for timeout.Single
. null
if the source
is of type Void
.java.util.concurrent.ExecutionException
- if the passed Publisher
terminates with a failure, or if the result of
await(Single, long, TimeUnit)
is null
.java.lang.InterruptedException
- if the thread was interrupted while waiting for termination.java.util.concurrent.TimeoutException
- If the result isn't available after waiting for the passed timeout
duration.await(Single, long, TimeUnit)
public static void awaitIndefinitely(Completable source) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException
Completable
by blocking the calling thread.source
- to await for.java.util.concurrent.ExecutionException
- if the passed Publisher
terminates with a failure.java.lang.InterruptedException
- if the thread was interrupted while waiting for termination.public static void awaitIndefinitelyUnchecked(Completable source)
Completable
by blocking the calling thread.
This method will re-throw exceptions from awaitIndefinitely(Completable)
.
source
- to await for.public static void await(Completable source, long timeout, java.util.concurrent.TimeUnit timeoutUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException
Completable
by blocking the calling thread.source
- to await for.timeout
- maximum time to wait for termination.timeoutUnit
- TimeUnit
for timeout.java.util.concurrent.ExecutionException
- if the passed Publisher
terminates with a failure.java.lang.InterruptedException
- if the thread was interrupted while waiting for termination.java.util.concurrent.TimeoutException
- If the Completable
isn't terminated after waiting for the passed
timeout
duration.