Skip to content

Commit 241dbda

Browse files
authored
Merge pull request #356 from akarnokd/TestExplanations
Add Javadoc explanation to the TCK test methods about what they do
2 parents c2e75b2 + 8fa3a27 commit 241dbda

File tree

2 files changed

+552
-32
lines changed

2 files changed

+552
-32
lines changed

Diff for: tck/src/main/java/org/reactivestreams/tck/PublisherVerification.java

-31
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ public void required_validate_boundedDepthOfOnNextAndRequestRecursion() throws E
204204

205205
////////////////////// SPEC RULE VERIFICATION ///////////////////////////////
206206

207-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.1
208207
@Override @Test
209208
public void required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements() throws Throwable {
210209
activePublisherTest(5, false, new PublisherTestRun<T>() {
@@ -227,7 +226,6 @@ public void run(Publisher<T> pub) throws InterruptedException {
227226
});
228227
}
229228

230-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.2
231229
@Override @Test
232230
public void required_spec102_maySignalLessThanRequestedAndTerminateSubscription() throws Throwable {
233231
final int elements = 3;
@@ -244,7 +242,6 @@ public void run(Publisher<T> pub) throws Throwable {
244242
});
245243
}
246244

247-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.3
248245
@Override @Test
249246
public void stochastic_spec103_mustSignalOnMethodsSequentially() throws Throwable {
250247
final int iterations = 100;
@@ -353,7 +350,6 @@ public void onComplete() {
353350
});
354351
}
355352

356-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.4
357353
@Override @Test
358354
public void optional_spec104_mustSignalOnErrorWhenFails() throws Throwable {
359355
try {
@@ -391,7 +387,6 @@ public void onError(Throwable cause) {
391387
}
392388
}
393389

394-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.5
395390
@Override @Test
396391
public void required_spec105_mustSignalOnCompleteWhenFiniteStreamTerminates() throws Throwable {
397392
activePublisherTest(3, true, new PublisherTestRun<T>() {
@@ -407,7 +402,6 @@ public void run(Publisher<T> pub) throws Throwable {
407402
});
408403
}
409404

410-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.5
411405
@Override @Test
412406
public void optional_spec105_emptyStreamMustTerminateBySignallingOnComplete() throws Throwable {
413407
optionalActivePublisherTest(0, true, new PublisherTestRun<T>() {
@@ -421,13 +415,11 @@ public void run(Publisher<T> pub) throws Throwable {
421415
});
422416
}
423417

424-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.6
425418
@Override @Test
426419
public void untested_spec106_mustConsiderSubscriptionCancelledAfterOnErrorOrOnCompleteHasBeenCalled() throws Throwable {
427420
notVerified(); // not really testable without more control over the Publisher
428421
}
429422

430-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.7
431423
@Override @Test
432424
public void required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled() throws Throwable {
433425
activePublisherTest(1, true, new PublisherTestRun<T>() {
@@ -444,25 +436,21 @@ public void run(Publisher<T> pub) throws Throwable {
444436
});
445437
}
446438

447-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.7
448439
@Override @Test
449440
public void untested_spec107_mustNotEmitFurtherSignalsOnceOnErrorHasBeenSignalled() throws Throwable {
450441
notVerified(); // can we meaningfully test this, without more control over the publisher?
451442
}
452443

453-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.8
454444
@Override @Test
455445
public void untested_spec108_possiblyCanceledSubscriptionShouldNotReceiveOnErrorOrOnCompleteSignals() throws Throwable {
456446
notVerified(); // can we meaningfully test this?
457447
}
458448

459-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.9
460449
@Override @Test
461450
public void untested_spec109_subscribeShouldNotThrowNonFatalThrowable() throws Throwable {
462451
notVerified(); // can we meaningfully test this?
463452
}
464453

465-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.9
466454
@Override @Test
467455
public void required_spec109_subscribeThrowNPEOnNullSubscriber() throws Throwable {
468456
activePublisherTest(0, false, new PublisherTestRun<T>() {
@@ -479,7 +467,6 @@ public void run(Publisher<T> pub) throws Throwable {
479467
});
480468
}
481469

482-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.9
483470
@Override @Test
484471
public void required_spec109_mustIssueOnSubscribeForNonNullSubscriber() throws Throwable {
485472
activePublisherTest(0, false, new PublisherTestRun<T>() {
@@ -514,7 +501,6 @@ public void onComplete() {
514501
});
515502
}
516503

517-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.9
518504
@Override @Test
519505
public void required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe() throws Throwable {
520506
whenHasErrorPublisherTest(new PublisherTestRun<T>() {
@@ -545,7 +531,6 @@ public void onSubscribe(Subscription subs) {
545531
});
546532
}
547533

548-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.10
549534
@Override @Test
550535
public void untested_spec110_rejectASubscriptionRequestIfTheSameSubscriberSubscribesTwice() throws Throwable {
551536
notVerified(); // can we meaningfully test this?
@@ -565,7 +550,6 @@ public void run(Publisher<T> pub) throws Throwable {
565550
});
566551
}
567552

568-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11
569553
@Override @Test
570554
public void optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingOneByOne() throws Throwable {
571555
optionalActivePublisherTest(5, true, new PublisherTestRun<T>() { // This test is skipped if the publisher is unbounded (never sends onComplete)
@@ -616,7 +600,6 @@ public void run(Publisher<T> pub) throws InterruptedException {
616600
});
617601
}
618602

619-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11
620603
@Override @Test
621604
public void optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront() throws Throwable {
622605
optionalActivePublisherTest(3, false, new PublisherTestRun<T>() { // This test is skipped if the publisher cannot produce enough elements
@@ -649,7 +632,6 @@ public void run(Publisher<T> pub) throws Throwable {
649632
});
650633
}
651634

652-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11
653635
@Override @Test
654636
public void optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfrontAndCompleteAsExpected() throws Throwable {
655637
optionalActivePublisherTest(3, true, new PublisherTestRun<T>() { // This test is skipped if the publisher is unbounded (never sends onComplete)
@@ -685,7 +667,6 @@ public void run(Publisher<T> pub) throws Throwable {
685667

686668
///////////////////// SUBSCRIPTION TESTS //////////////////////////////////
687669

688-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.2
689670
@Override @Test
690671
public void required_spec302_mustAllowSynchronousRequestCallsFromOnNextAndOnSubscribe() throws Throwable {
691672
activePublisherTest(6, false, new PublisherTestRun<T>() {
@@ -715,7 +696,6 @@ public void onNext(T element) {
715696
});
716697
}
717698

718-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.3
719699
@Override @Test
720700
public void required_spec303_mustNotAllowUnboundedRecursion() throws Throwable {
721701
final long oneMoreThanBoundedLimit = boundedDepthOfOnNextAndRequestRecursion() + 1;
@@ -798,19 +778,16 @@ public void onError(Throwable cause) {
798778
});
799779
}
800780

801-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.4
802781
@Override @Test
803782
public void untested_spec304_requestShouldNotPerformHeavyComputations() throws Exception {
804783
notVerified(); // cannot be meaningfully tested, or can it?
805784
}
806785

807-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.5
808786
@Override @Test
809787
public void untested_spec305_cancelMustNotSynchronouslyPerformHeavyCompuatation() throws Exception {
810788
notVerified(); // cannot be meaningfully tested, or can it?
811789
}
812790

813-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.6
814791
@Override @Test
815792
public void required_spec306_afterSubscriptionIsCancelledRequestMustBeNops() throws Throwable {
816793
activePublisherTest(3, false, new PublisherTestRun<T>() {
@@ -844,7 +821,6 @@ public void cancel() {
844821
});
845822
}
846823

847-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.7
848824
@Override @Test
849825
public void required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsMustBeNops() throws Throwable {
850826
activePublisherTest(1, false, new PublisherTestRun<T>() {
@@ -865,7 +841,6 @@ public void run(Publisher<T> pub) throws Throwable {
865841
});
866842
}
867843

868-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.9
869844
@Override @Test
870845
public void required_spec309_requestZeroMustSignalIllegalArgumentException() throws Throwable {
871846
activePublisherTest(10, false, new PublisherTestRun<T>() {
@@ -877,7 +852,6 @@ public void required_spec309_requestZeroMustSignalIllegalArgumentException() thr
877852
});
878853
}
879854

880-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.9
881855
@Override @Test
882856
public void required_spec309_requestNegativeNumberMustSignalIllegalArgumentException() throws Throwable {
883857
activePublisherTest(10, false, new PublisherTestRun<T>() {
@@ -891,7 +865,6 @@ public void run(Publisher<T> pub) throws Throwable {
891865
});
892866
}
893867

894-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.12
895868
@Override @Test
896869
public void required_spec312_cancelMustMakeThePublisherToEventuallyStopSignaling() throws Throwable {
897870
// the publisher is able to signal more elements than the subscriber will be requesting in total
@@ -954,7 +927,6 @@ > AsyncPublisher receives cancel() - handles it right away, by "stopping itself"
954927
env.verifyNoAsyncErrorsNoDelay();
955928
}
956929

957-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.13
958930
@Override @Test
959931
public void required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber() throws Throwable {
960932
final ReferenceQueue<ManualSubscriber<T>> queue = new ReferenceQueue<ManualSubscriber<T>>();
@@ -992,7 +964,6 @@ public void run(Publisher<T> pub) throws Throwable {
992964
});
993965
}
994966

995-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.17
996967
@Override @Test
997968
public void required_spec317_mustSupportAPendingElementCountUpToLongMaxValue() throws Throwable {
998969
final int totalElements = 3;
@@ -1011,7 +982,6 @@ public void run(Publisher<T> pub) throws Throwable {
1011982
});
1012983
}
1013984

1014-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.17
1015985
@Override @Test
1016986
public void required_spec317_mustSupportACumulativePendingElementCountUpToLongMaxValue() throws Throwable {
1017987
final int totalElements = 3;
@@ -1037,7 +1007,6 @@ public void run(Publisher<T> pub) throws Throwable {
10371007
});
10381008
}
10391009

1040-
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.17
10411010
@Override @Test
10421011
public void required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue() throws Throwable {
10431012
activePublisherTest(Integer.MAX_VALUE, false, new PublisherTestRun<T>() {

0 commit comments

Comments
 (0)