T
- Type of the result of this TestSingle
.public final class TestSingle<T> extends Single<T> implements SingleSource<T>
Single
& SingleSource
whose outgoing signals to its Subscriber
s can be controlled.
Behavior beyond simply delegating signals to the Subscriber
is accomplished by a
Function<Subscriber<? super T>, Subscriber<? super T>>
. This Function
is
invoked for every SingleSource.subscribe(Subscriber)
invocation, and the result is used as the delegate for subsequent
onSubscribe(Cancellable)
, onSuccess(Object)
, and
onError(Throwable)
calls. See TestSingle.Builder
for more information.
onSubscribe(Cancellable)
automatically when subscribed to.Modifier and Type | Class and Description |
---|---|
static class |
TestSingle.Builder<T>
Allows for creating
TestSingle s with non-default settings. |
SingleSource.Processor<T,R>, SingleSource.Subscriber<T>
Constructor and Description |
---|
TestSingle()
Create a
TestSingle with the defaults. |
Modifier and Type | Method and Description |
---|---|
protected void |
handleSubscribe(SingleSource.Subscriber<? super T> subscriber)
Handles a subscriber to this
Single . |
boolean |
isSubscribed()
|
void |
onError(java.lang.Throwable t)
Delivers the
Throwable t to the Subscriber . |
void |
onSubscribe(Cancellable cancellable)
|
void |
onSuccess(T result)
Delivers the
result to the Subscriber . |
void |
subscribe(SingleSource.Subscriber<? super T> subscriber)
Subscribe for the result of this
SingleSource . |
afterCancel, afterFinally, afterFinally, afterFinally, afterOnError, afterOnSubscribe, afterOnSuccess, afterSubscriber, amb, amb, ambWith, anyOf, anyOf, beforeCancel, beforeFinally, beforeFinally, beforeFinally, beforeOnError, beforeOnSubscribe, beforeOnSuccess, beforeSubscriber, collectUnordered, collectUnordered, collectUnordered, collectUnordered, collectUnorderedDelayError, collectUnorderedDelayError, collectUnorderedDelayError, collectUnorderedDelayError, concat, concat, concat, defer, failed, flatMap, flatMapCompletable, flatMapPublisher, fromCallable, fromFuture, fromStage, fromSupplier, idleTimeout, idleTimeout, idleTimeout, idleTimeout, ignoreElement, liftAsync, liftSync, map, never, publishAndSubscribeOn, publishAndSubscribeOnOverride, publishOn, publishOnOverride, recoverWith, repeat, repeatWhen, retry, retryWhen, subscribe, subscribeInternal, subscribeOn, subscribeOnOverride, subscribeShareContext, succeeded, toCompletable, toCompletionStage, toFuture, toPublisher, whenCancel, whenFinally, whenFinally, whenFinally, whenOnError, whenOnSubscribe, whenOnSuccess, whenSubscriber
public TestSingle()
TestSingle
with the defaults. See Defaults section of class javadoc.public boolean isSubscribed()
true
if this TestSingle
has been subscribed to, false
otherwise.protected void handleSubscribe(SingleSource.Subscriber<? super T> subscriber)
Single
Single
.handleSubscribe
in class Single<T>
subscriber
- the subscriber.public void subscribe(SingleSource.Subscriber<? super T> subscriber)
SingleSource
SingleSource
.subscribe
in interface SingleSource<T>
subscriber
- to subscribe for the result.PublisherSource.subscribe(PublisherSource.Subscriber)
public void onSubscribe(Cancellable cancellable)
Cancellable
to the Subscriber
's Subscriber#onSubscribe(Cancellable)
.
In the case of auto-on-subscribe
, the delegating Cancellable
sent to
the Subscriber
by the auto-on-subscribe will switch to cancellable
.
cancellable
- the Cancellable
public void onSuccess(@Nullable T result)
result
to the Subscriber
.result
- the result to deliver.Subscriber#onSuccess(Object)
public void onError(java.lang.Throwable t)
Throwable
t
to the Subscriber
.t
- the error to deliver.Subscriber#onError(Throwable)