Package io.smallrye.mutiny.helpers.test
Class AbstractSubscriber<T>
- java.lang.Object
-
- io.smallrye.mutiny.helpers.test.AbstractSubscriber<T>
-
- Type Parameters:
T
- the type of the items
- All Implemented Interfaces:
org.reactivestreams.Subscriber<T>
,org.reactivestreams.Subscription
public class AbstractSubscriber<T> extends java.lang.Object implements org.reactivestreams.Subscriber<T>, org.reactivestreams.Subscription
A convenient base class for a subscriber and subscription to extend in tests and that manages the subscription and requests.Implementations shall override
onNext(Object)
,onError(Throwable)
and/oronComplete()
to add test-specific custom logic.
-
-
Constructor Summary
Constructors Constructor Description AbstractSubscriber()
Creates a newAbstractSubscriber
with 0 upfront requests.AbstractSubscriber(long req)
Creates a newAbstractSubscriber
withreq
upfront requests.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
void
onComplete()
void
onError(java.lang.Throwable t)
void
onNext(T t)
void
onSubscribe(org.reactivestreams.Subscription s)
void
request(long n)
-
-
-
Constructor Detail
-
AbstractSubscriber
public AbstractSubscriber()
Creates a newAbstractSubscriber
with 0 upfront requests.
-
AbstractSubscriber
public AbstractSubscriber(long req)
Creates a newAbstractSubscriber
withreq
upfront requests.- Parameters:
req
- the number of upfront requests
-
-
Method Detail
-
onSubscribe
public void onSubscribe(org.reactivestreams.Subscription s)
- Specified by:
onSubscribe
in interfaceorg.reactivestreams.Subscriber<T>
-
onError
public void onError(java.lang.Throwable t)
- Specified by:
onError
in interfaceorg.reactivestreams.Subscriber<T>
-
onComplete
public void onComplete()
- Specified by:
onComplete
in interfaceorg.reactivestreams.Subscriber<T>
-
request
public void request(long n)
- Specified by:
request
in interfaceorg.reactivestreams.Subscription
-
cancel
public void cancel()
- Specified by:
cancel
in interfaceorg.reactivestreams.Subscription
-
-