Class WithHelperPublisher<T>
- java.lang.Object
-
- org.reactivestreams.tck.WithHelperPublisher<T>
-
- Type Parameters:
T
- type of element to be delivered to the Subscriber
- Direct Known Subclasses:
IdentityProcessorVerification
,SubscriberBlackboxVerification
,SubscriberWhiteboxVerification
public abstract class WithHelperPublisher<T> extends java.lang.Object
Type which is able to create elements based on a seedid
value.Simplest implementations will simply return the incoming id as the element.
-
-
Constructor Summary
Constructors Constructor Description WithHelperPublisher()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract T
createElement(int element)
Implement this method to match your expected element type.org.reactivestreams.Publisher<T>
createHelperPublisher(long elements)
Helper method required for creating the Publisher to which the tested Subscriber will be subscribed and tested against.abstract java.util.concurrent.ExecutorService
publisherExecutorService()
ExecutorService to be used by the provided helperPublisher
-
-
-
Constructor Detail
-
WithHelperPublisher
public WithHelperPublisher()
-
-
Method Detail
-
publisherExecutorService
public abstract java.util.concurrent.ExecutorService publisherExecutorService()
ExecutorService to be used by the provided helperPublisher
-
createElement
public abstract T createElement(int element)
Implement this method to match your expected element type. In case of implementing a simple Subscriber which is able to consume any kind of element simply return the incomingelement
element.Sometimes the Subscriber may be limited in what type of element it is able to consume, this you may have to implement this method such that the emitted element matches the Subscribers requirements. Simplest implementations would be to simply pass in the
element
as payload of your custom element, such as appending it to a String or other identifier.Warning: This method may be called concurrently by the helper publisher, thus it should be implemented in a thread-safe manner.
- Returns:
- element of the matching type
T
that will be delivered to the tested Subscriber
-
createHelperPublisher
public org.reactivestreams.Publisher<T> createHelperPublisher(long elements)
Helper method required for creating the Publisher to which the tested Subscriber will be subscribed and tested against.By default an asynchronously signalling Publisher is provided, which will use
createElement(int)
to generate elements type your Subscriber is able to consume.Sometimes you may want to implement your own custom custom helper Publisher - to validate behaviour of a Subscriber when facing a synchronous Publisher for example. If you do, it MUST emit the exact number of elements asked for (via the
elements
parameter) and MUST also must treat the following numbers of elements in these specific ways:-
If
elements
isLong.MAX_VALUE
the produced stream must be infinite. -
If
elements
is0
thePublisher
should signalonComplete
immediatly. In other words, it should represent a "completed stream".
-
If
-
-