Package org.reactivestreams.tck
Class SubscriberWhiteboxVerification<T>
java.lang.Object
org.reactivestreams.tck.WithHelperPublisher<T>
org.reactivestreams.tck.SubscriberWhiteboxVerification<T>
- All Implemented Interfaces:
SubscriberWhiteboxVerificationRules
- Direct Known Subclasses:
FlowSubscriberWhiteboxVerification
public abstract class SubscriberWhiteboxVerification<T>
extends WithHelperPublisher<T>
implements SubscriberWhiteboxVerificationRules
Provides whitebox style tests for verifying
Subscriber
and Subscription
specification rules.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
This class is intented to be used asSubscriber
decorator and should be used inpub.subscriber(...)
calls, in order to allow intercepting calls on the underlyingSubscriber
.static interface
static interface
Implement this puppet in your Whitebox style tests.static interface
(package private) class
static class
class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TestEnvironment
private ExecutorService
Executor service used by the default provided asynchronous Publisher. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Subscriber
<T> This is the main method you must implement in your test incarnation.void
void
notVerified
(String msg) void
Test for feature that MAY be implemented.ExecutorService to be used by the provided helperPublisher
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
setUp()
void
void
void
Prepares subscriber and publisher pair (by subscribing the first to the latter), and then hands over the testsSubscriberWhiteboxVerification<T>.WhiteboxTestStage
over to the test.void
Provides aSubscriberWhiteboxVerification<T>.WhiteboxTestStage
without performing any additional setup, like thesubscriberTest(SubscriberWhiteboxVerification.TestStageTestRun)
would.void
void
void
void
void
untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents()
void
void
void
void
void
void
void
void
Methods inherited from class org.reactivestreams.tck.WithHelperPublisher
createElement, createHelperPublisher
-
Field Details
-
env
-
publisherExecutor
Executor service used by the default provided asynchronous Publisher.- See Also:
-
-
Constructor Details
-
SubscriberWhiteboxVerification
-
-
Method Details
-
createSubscriber
public abstract Subscriber<T> createSubscriber(SubscriberWhiteboxVerification.WhiteboxSubscriberProbe<T> probe) This is the main method you must implement in your test incarnation. It must create a newSubscriber
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. -
startPublisherExecutorService
@BeforeClass public void startPublisherExecutorService() -
shutdownPublisherExecutorService
@AfterClass public void shutdownPublisherExecutorService() -
publisherExecutorService
Description copied from class:WithHelperPublisher
ExecutorService to be used by the provided helperPublisher
- Specified by:
publisherExecutorService
in classWithHelperPublisher<T>
-
setUp
- Throws:
Exception
-
required_exerciseWhiteboxHappyPath
- Specified by:
required_exerciseWhiteboxHappyPath
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
required_spec201_mustSignalDemandViaSubscriptionRequest
- Specified by:
required_spec201_mustSignalDemandViaSubscriptionRequest
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
untested_spec202_shouldAsynchronouslyDispatch
- Specified by:
untested_spec202_shouldAsynchronouslyDispatch
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Exception
-
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete
public void required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete() throws Throwable- Specified by:
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError
public void required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError() throws Throwable- Specified by:
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError
public void untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError() throws Exception- Specified by:
untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Exception
-
required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal
public void required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal() throws Throwable -
untested_spec206_mustCallSubscriptionCancelIfItIsNoLongerValid
- Specified by:
untested_spec206_mustCallSubscriptionCancelIfItIsNoLongerValid
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Exception
-
untested_spec207_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization
public void untested_spec207_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization() throws Exception -
required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel
public void required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel() throws Throwable- Specified by:
required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall
public void required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall() throws Throwable- Specified by:
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall
public void required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall() throws Throwable- Specified by:
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall
public void required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall() throws Throwable- Specified by:
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall
public void required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall() throws Throwable- Specified by:
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents
public void untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents() throws Exception- Specified by:
untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Exception
-
untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation
public void untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation() throws Throwable- Specified by:
untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
untested_spec213_failingOnSignalInvocation
- Specified by:
untested_spec213_failingOnSignalInvocation
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Exception
-
required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull
public void required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull() throws Throwable- Specified by:
required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull
public void required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull() throws Throwable- Specified by:
required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull
public void required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull() throws Throwable- Specified by:
required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
untested_spec301_mustNotBeCalledOutsideSubscriberContext
- Specified by:
untested_spec301_mustNotBeCalledOutsideSubscriberContext
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Exception
-
required_spec308_requestMustRegisterGivenNumberElementsToBeProduced
- Specified by:
required_spec308_requestMustRegisterGivenNumberElementsToBeProduced
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Throwable
-
untested_spec310_requestMaySynchronouslyCallOnNextOnSubscriber
- Specified by:
untested_spec310_requestMaySynchronouslyCallOnNextOnSubscriber
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Exception
-
untested_spec311_requestMaySynchronouslyCallOnCompleteOrOnError
- Specified by:
untested_spec311_requestMaySynchronouslyCallOnCompleteOrOnError
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Exception
-
untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists
public void untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists() throws Exception- Specified by:
untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Exception
-
untested_spec315_cancelMustNotThrowExceptionAndMustSignalOnError
- Specified by:
untested_spec315_cancelMustNotThrowExceptionAndMustSignalOnError
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Exception
-
untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber
public void untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber() throws Exception- Specified by:
untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
Exception
-
subscriberTest
public void subscriberTest(SubscriberWhiteboxVerification<T>.TestStageTestRun body) throws Throwable Prepares subscriber and publisher pair (by subscribing the first to the latter), and then hands over the testsSubscriberWhiteboxVerification<T>.WhiteboxTestStage
over to the test. The test stage is, like in a puppet show, used to orchestrate what each participant should do. Since this is a whitebox test, this allows the stage to completely control when and how to signal / expect signals.- Throws:
Throwable
-
subscriberTestWithoutSetup
public void subscriberTestWithoutSetup(SubscriberWhiteboxVerification<T>.TestStageTestRun body) throws Throwable Provides aSubscriberWhiteboxVerification<T>.WhiteboxTestStage
without performing any additional setup, like thesubscriberTest(SubscriberWhiteboxVerification.TestStageTestRun)
would. Use this method to write tests in which you need full control over when and how the initialsubscribe
is signalled.- Throws:
Throwable
-
optionalSubscriberTestWithoutSetup
public void optionalSubscriberTestWithoutSetup(SubscriberWhiteboxVerification<T>.TestStageTestRun body) throws Throwable Test for feature that MAY be implemented. This test will be marked as SKIPPED if it fails.- Throws:
Throwable
-
notVerified
public void notVerified() -
notVerified
-