-
Notifications
You must be signed in to change notification settings - Fork 534
/
Copy pathFlowSubscriberWhiteboxVerification.java
48 lines (42 loc) · 2.18 KB
/
FlowSubscriberWhiteboxVerification.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/************************************************************************
* Licensed under Public Domain (CC0) *
* *
* To the extent possible under law, the person who associated CC0 with *
* this code has waived all copyright and related or neighboring *
* rights to this code. *
* *
* You should have received a copy of the CC0 legalcode along with this *
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.*
************************************************************************/
package org.reactivestreams.tck.flow;
import org.reactivestreams.FlowAdapters;
import org.reactivestreams.Subscriber;
import org.reactivestreams.tck.SubscriberWhiteboxVerification;
import org.reactivestreams.tck.TestEnvironment;
import org.reactivestreams.tck.flow.support.SubscriberWhiteboxVerificationRules;
import java.util.concurrent.Flow;
/**
* Provides whitebox style tests for verifying {@link java.util.concurrent.Flow.Subscriber}
* and {@link java.util.concurrent.Flow.Subscription} specification rules.
*
* @see java.util.concurrent.Flow.Subscriber
* @see java.util.concurrent.Flow.Subscription
*/
public abstract class FlowSubscriberWhiteboxVerification<T> extends SubscriberWhiteboxVerification<T>
implements SubscriberWhiteboxVerificationRules {
protected FlowSubscriberWhiteboxVerification(TestEnvironment env) {
super(env);
}
@Override
final public Subscriber<T> createSubscriber(WhiteboxSubscriberProbe<T> probe) {
return FlowAdapters.toSubscriber(createFlowSubscriber(probe));
}
/**
* This is the main method you must implement in your test incarnation.
* It must create a new {@link org.reactivestreams.Subscriber} instance to be subjected to the testing logic.
*
* In order to be meaningfully testable your Subscriber must inform the given
* `WhiteboxSubscriberProbe` of the respective events having been received.
*/
protected abstract Flow.Subscriber<T> createFlowSubscriber(WhiteboxSubscriberProbe<T> probe);
}