Package org.reactivestreams.tck
Class SubscriberWhiteboxVerification<T>
- java.lang.Object
-
- org.reactivestreams.tck.WithHelperPublisher<T>
-
- org.reactivestreams.tck.SubscriberWhiteboxVerification<T>
-
- All Implemented Interfaces:
SubscriberWhiteboxVerificationRules
public abstract class SubscriberWhiteboxVerification<T> extends WithHelperPublisher<T> implements SubscriberWhiteboxVerificationRules
Provides whitebox style tests for verifyingSubscriber
andSubscription
specification rules.- See Also:
Subscriber
,Subscription
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SubscriberWhiteboxVerification.BlackboxProbe<T>
static class
SubscriberWhiteboxVerification.BlackboxSubscriberProxy<T>
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
SubscriberWhiteboxVerification.SubscriberProbe<T>
static interface
SubscriberWhiteboxVerification.SubscriberPuppet
Implement this puppet in your Whitebox style tests.static interface
SubscriberWhiteboxVerification.SubscriberPuppeteer
static class
SubscriberWhiteboxVerification.WhiteboxSubscriberProbe<T>
class
SubscriberWhiteboxVerification.WhiteboxTestStage
-
Constructor Summary
Constructors Modifier Constructor Description protected
SubscriberWhiteboxVerification(TestEnvironment env)
-
Method Summary
-
Methods inherited from class org.reactivestreams.tck.WithHelperPublisher
createElement, createHelperPublisher
-
-
-
-
Constructor Detail
-
SubscriberWhiteboxVerification
protected SubscriberWhiteboxVerification(TestEnvironment env)
-
-
Method Detail
-
createSubscriber
public abstract org.reactivestreams.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
public java.util.concurrent.ExecutorService publisherExecutorService()
Description copied from class:WithHelperPublisher
ExecutorService to be used by the provided helperPublisher
- Specified by:
publisherExecutorService
in classWithHelperPublisher<T>
-
setUp
@BeforeMethod public void setUp() throws java.lang.Exception
- Throws:
java.lang.Exception
-
required_exerciseWhiteboxHappyPath
public void required_exerciseWhiteboxHappyPath() throws java.lang.Throwable
- Specified by:
required_exerciseWhiteboxHappyPath
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
required_spec201_mustSignalDemandViaSubscriptionRequest
public void required_spec201_mustSignalDemandViaSubscriptionRequest() throws java.lang.Throwable
- Specified by:
required_spec201_mustSignalDemandViaSubscriptionRequest
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
untested_spec202_shouldAsynchronouslyDispatch
public void untested_spec202_shouldAsynchronouslyDispatch() throws java.lang.Exception
- Specified by:
untested_spec202_shouldAsynchronouslyDispatch
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Exception
-
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete
public void required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete() throws java.lang.Throwable
- Specified by:
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError
public void required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError() throws java.lang.Throwable
- Specified by:
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError
public void untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError() throws java.lang.Exception
- Specified by:
untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Exception
-
required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal
public void required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal() throws java.lang.Throwable
- Specified by:
required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
untested_spec206_mustCallSubscriptionCancelIfItIsNoLongerValid
public void untested_spec206_mustCallSubscriptionCancelIfItIsNoLongerValid() throws java.lang.Exception
- Specified by:
untested_spec206_mustCallSubscriptionCancelIfItIsNoLongerValid
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Exception
-
untested_spec207_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization
public void untested_spec207_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization() throws java.lang.Exception
- Specified by:
untested_spec207_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Exception
-
required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel
public void required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel() throws java.lang.Throwable
- Specified by:
required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall
public void required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall() throws java.lang.Throwable
- Specified by:
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall
public void required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall() throws java.lang.Throwable
- Specified by:
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall
public void required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall() throws java.lang.Throwable
- Specified by:
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall
public void required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall() throws java.lang.Throwable
- Specified by:
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents
public void untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents() throws java.lang.Exception
- Specified by:
untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Exception
-
untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation
public void untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation() throws java.lang.Throwable
- Specified by:
untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
untested_spec213_failingOnSignalInvocation
public void untested_spec213_failingOnSignalInvocation() throws java.lang.Exception
- Specified by:
untested_spec213_failingOnSignalInvocation
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Exception
-
required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull
public void required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull() throws java.lang.Throwable
- Specified by:
required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull
public void required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull() throws java.lang.Throwable
- Specified by:
required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull
public void required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull() throws java.lang.Throwable
- Specified by:
required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
untested_spec301_mustNotBeCalledOutsideSubscriberContext
public void untested_spec301_mustNotBeCalledOutsideSubscriberContext() throws java.lang.Exception
- Specified by:
untested_spec301_mustNotBeCalledOutsideSubscriberContext
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Exception
-
required_spec308_requestMustRegisterGivenNumberElementsToBeProduced
public void required_spec308_requestMustRegisterGivenNumberElementsToBeProduced() throws java.lang.Throwable
- Specified by:
required_spec308_requestMustRegisterGivenNumberElementsToBeProduced
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Throwable
-
untested_spec310_requestMaySynchronouslyCallOnNextOnSubscriber
public void untested_spec310_requestMaySynchronouslyCallOnNextOnSubscriber() throws java.lang.Exception
- Specified by:
untested_spec310_requestMaySynchronouslyCallOnNextOnSubscriber
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Exception
-
untested_spec311_requestMaySynchronouslyCallOnCompleteOrOnError
public void untested_spec311_requestMaySynchronouslyCallOnCompleteOrOnError() throws java.lang.Exception
- Specified by:
untested_spec311_requestMaySynchronouslyCallOnCompleteOrOnError
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Exception
-
untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists
public void untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists() throws java.lang.Exception
- Specified by:
untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Exception
-
untested_spec315_cancelMustNotThrowExceptionAndMustSignalOnError
public void untested_spec315_cancelMustNotThrowExceptionAndMustSignalOnError() throws java.lang.Exception
- Specified by:
untested_spec315_cancelMustNotThrowExceptionAndMustSignalOnError
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Exception
-
untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber
public void untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber() throws java.lang.Exception
- Specified by:
untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber
in interfaceSubscriberWhiteboxVerificationRules
- Throws:
java.lang.Exception
-
subscriberTest
public void subscriberTest(org.reactivestreams.tck.SubscriberWhiteboxVerification.TestStageTestRun body) throws java.lang.Throwable
Prepares subscriber and publisher pair (by subscribing the first to the latter), and then hands over the testsSubscriberWhiteboxVerification.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:
java.lang.Throwable
-
subscriberTestWithoutSetup
public void subscriberTestWithoutSetup(org.reactivestreams.tck.SubscriberWhiteboxVerification.TestStageTestRun body) throws java.lang.Throwable
Provides aSubscriberWhiteboxVerification.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:
java.lang.Throwable
-
optionalSubscriberTestWithoutSetup
public void optionalSubscriberTestWithoutSetup(org.reactivestreams.tck.SubscriberWhiteboxVerification.TestStageTestRun body) throws java.lang.Throwable
Test for feature that MAY be implemented. This test will be marked as SKIPPED if it fails.- Throws:
java.lang.Throwable
-
notVerified
public void notVerified()
-
notVerified
public void notVerified(java.lang.String msg)
-
-