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 classstatic classThis class is intented to be used asSubscriberdecorator and should be used inpub.subscriber(...)calls, in order to allow intercepting calls on the underlyingSubscriber.static interfacestatic interfaceImplement this puppet in your Whitebox style tests.static interface(package private) class//////////////////// TEST INFRASTRUCTURE /////////////////////////////////static classclass -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TestEnvironmentprivate ExecutorServiceExecutor 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.voidvoidnotVerified(String msg) voidTest for feature that MAY be implemented.ExecutorService to be used by the provided helperPublishervoid/////////////////// TEST SETUP VERIFICATION //////////////////////////////void/////////////////// SPEC RULE VERIFICATION ///////////////////////////////voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidsetUp()/////////////////// TEST ENV CLEANUP /////////////////////////////////////voidvoidvoidPrepares subscriber and publisher pair (by subscribing the first to the latter), and then hands over the testsSubscriberWhiteboxVerification<T>.WhiteboxTestStageover to the test.voidProvides aSubscriberWhiteboxVerification<T>.WhiteboxTestStagewithout performing any additional setup, like thesubscriberTest(SubscriberWhiteboxVerification.TestStageTestRun)would.voidvoidvoidvoidvoiduntested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents()voidvoidvoid/////////////////// SUBSCRIPTION SPEC RULE VERIFICATION //////////////////voidvoidvoidvoidvoidMethods inherited from class 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 newSubscriberinstance 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:WithHelperPublisherExecutorService to be used by the provided helperPublisher- Specified by:
publisherExecutorServicein classWithHelperPublisher<T>
-
setUp
-
required_exerciseWhiteboxHappyPath
/////////////////// TEST SETUP VERIFICATION //////////////////////////////- Specified by:
required_exerciseWhiteboxHappyPathin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
required_spec201_mustSignalDemandViaSubscriptionRequest
/////////////////// SPEC RULE VERIFICATION ///////////////////////////////- Specified by:
required_spec201_mustSignalDemandViaSubscriptionRequestin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
untested_spec202_shouldAsynchronouslyDispatch
- Specified by:
untested_spec202_shouldAsynchronouslyDispatchin interfaceSubscriberWhiteboxVerificationRules- Throws:
Exception
-
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete
public void required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete() throws Throwable- Specified by:
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnCompletein interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError
public void required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError() throws Throwable- Specified by:
required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnErrorin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError
public void untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError() throws Exception- Specified by:
untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnErrorin interfaceSubscriberWhiteboxVerificationRules- Throws:
Exception
-
required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal
public void required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal() throws Throwable -
untested_spec206_mustCallSubscriptionCancelIfItIsNoLongerValid
- Specified by:
untested_spec206_mustCallSubscriptionCancelIfItIsNoLongerValidin 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_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancelin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall
public void required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall() throws Throwable- Specified by:
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCallin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall
public void required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall() throws Throwable- Specified by:
required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCallin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall
public void required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall() throws Throwable- Specified by:
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCallin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall
public void required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall() throws Throwable- Specified by:
required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCallin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents
public void untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents() throws Exception- Specified by:
untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEventsin interfaceSubscriberWhiteboxVerificationRules- Throws:
Exception
-
untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation
public void untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation() throws Throwable- Specified by:
untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolationin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
untested_spec213_failingOnSignalInvocation
- Specified by:
untested_spec213_failingOnSignalInvocationin interfaceSubscriberWhiteboxVerificationRules- Throws:
Exception
-
required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull
public void required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull() throws Throwable- Specified by:
required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNullin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull
public void required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull() throws Throwable- Specified by:
required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNullin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull
public void required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull() throws Throwable- Specified by:
required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNullin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
untested_spec301_mustNotBeCalledOutsideSubscriberContext
/////////////////// SUBSCRIPTION SPEC RULE VERIFICATION //////////////////- Specified by:
untested_spec301_mustNotBeCalledOutsideSubscriberContextin interfaceSubscriberWhiteboxVerificationRules- Throws:
Exception
-
required_spec308_requestMustRegisterGivenNumberElementsToBeProduced
- Specified by:
required_spec308_requestMustRegisterGivenNumberElementsToBeProducedin interfaceSubscriberWhiteboxVerificationRules- Throws:
Throwable
-
untested_spec310_requestMaySynchronouslyCallOnNextOnSubscriber
- Specified by:
untested_spec310_requestMaySynchronouslyCallOnNextOnSubscriberin interfaceSubscriberWhiteboxVerificationRules- Throws:
Exception
-
untested_spec311_requestMaySynchronouslyCallOnCompleteOrOnError
- Specified by:
untested_spec311_requestMaySynchronouslyCallOnCompleteOrOnErrorin interfaceSubscriberWhiteboxVerificationRules- Throws:
Exception
-
untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists
public void untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists() throws Exception- Specified by:
untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExistsin interfaceSubscriberWhiteboxVerificationRules- Throws:
Exception
-
untested_spec315_cancelMustNotThrowExceptionAndMustSignalOnError
- Specified by:
untested_spec315_cancelMustNotThrowExceptionAndMustSignalOnErrorin interfaceSubscriberWhiteboxVerificationRules- Throws:
Exception
-
untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber
public void untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber() throws Exception- Specified by:
untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriberin 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>.WhiteboxTestStageover 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>.WhiteboxTestStagewithout 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 initialsubscribeis 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
-