Skip to content

Commit 41cd764

Browse files
committed
Fixed #188 by making 2.12 an untested rule, as it cannot be deterministically verified.
Introduces prefix naming for TCK rules using "required_", "optional_", "untested_" and "stochastic_". Updates tck/README.md to reflect these changes Deletes the Annotations.java file as the annotations are no longer used. Introduces interfaces for the TCK test methods so it is possible to keep track of implementations, perform deprecations etc.
1 parent b4f359f commit 41cd764

12 files changed

+436
-472
lines changed

tck/README.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -45,38 +45,40 @@ Specification rule abides the following naming convention: `spec###_DESC` where:
4545

4646
```java
4747
// Verifies rule: https://github.com/reactive-streams/reactive-streams#1.1
48-
@Required @Test
49-
public void spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements() throws Throwable {
48+
@Test public void required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements() throws Throwable
5049
// ...
5150
}
5251
```
5352

54-
The annotations on the test methods are used in order to signify the character of the test. For example, these are the kinds of annotations you may find:
53+
The prefixes of the names of the test methods are used in order to signify the character of the test. For example, these are the kinds of prefixes you may find:
54+
"required_", "optional_", "stochastic_", "untested_".
55+
56+
Explanations:
5557

5658
```java
57-
@Required @Test
59+
@Test public void required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements() throws Throwable
5860
```
5961

6062
... means that this test case is a hard requirement, it covers a *MUST* or *MUST NOT* Rule of the Specification.
6163

6264

6365
```java
64-
@Additional @Test
66+
@Test public void optional_spec104_mustSignalOnErrorWhenFails() throws Throwable
6567
```
6668

67-
... means that this test case is optional, it covers a *MAY* or *SHOULD* Rule of the Specification. This annotation is also used if more configuration is needed in order to run it, e.g. `@Additional(implement = "createErrorStatePublisher") @Test` signals the implementer that in order to include this test case in his test runs, (s)he must implement the `Publisher<T> createErrorStatePublisher()` method.
69+
... means that this test case is optional, it covers a *MAY* or *SHOULD* Rule of the Specification. This prefix is also used if more configuration is needed in order to run it, e.g. `@Additional(implement = "createErrorStatePublisher") @Test` signals the implementer that in order to include this test case in his test runs, (s)he must implement the `Publisher<T> createErrorStatePublisher()` method.
6870

6971
```java
70-
@Stochastic @Test
72+
@Test public void stochastic_spec103_mustSignalOnMethodsSequentially() throws Throwable
7173
```
7274

7375
... means that the Rule is either racy, and/or inherently hard to verify without heavy modification of the tested implementation. Usually this means that this test case can yield false positives ("be green") even if for some case, the given implementation may violate the tested behaviour.
7476

7577
```java
76-
@NotVerified @Test
78+
@Test public void untested_spec106_mustConsiderSubscriptionCancelledAfterOnErrorOrOnCompleteHasBeenCalled() throws Throwable
7779
```
7880

79-
... means that the test case is not implemented, either because it is inherently hard to verify (e.g. Rules which use the wording "*SHOULD consider X as Y*") or have not been implemented yet (though we hope we have implemented all we could!). Such tests will show up in your test runs as `SKIPPED`, with a message pointing out that the TCK is unable to validate this Rule. We would be delighted if you can figure out a way to deterministically test Rules, which have been marked with this annotation – pull requests are very welcome!
81+
... means that the test case is not implemented, either because it is inherently hard to verify (e.g. Rules which use the wording "*SHOULD consider X as Y*") or have not been implemented yet (though we hope we have implemented all we could!). Such tests will show up in your test runs as `SKIPPED`, with a message pointing out that the TCK is unable to validate this Rule. We would be delighted if you can figure out a way to deterministically test Rules, which have been marked with this prefix – pull requests are very welcome!
8082

8183
### Test isolation
8284

tck/src/main/java/org/reactivestreams/tck/IdentityProcessorVerification.java

+117-117
Large diffs are not rendered by default.

tck/src/main/java/org/reactivestreams/tck/PublisherVerification.java

+71-71
Large diffs are not rendered by default.

tck/src/main/java/org/reactivestreams/tck/SubscriberBlackboxVerification.java

+22-22
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void setUp() throws Exception {
6767

6868
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.1
6969
@Override @Test
70-
public void required___spec201_blackbox_mustSignalDemandViaSubscriptionRequest() throws Throwable {
70+
public void required_spec201_blackbox_mustSignalDemandViaSubscriptionRequest() throws Throwable {
7171
blackboxSubscriberTest(new BlackboxTestStageTestRun() {
7272
@Override
7373
public void run(BlackboxTestStage stage) throws InterruptedException {
@@ -82,13 +82,13 @@ public void run(BlackboxTestStage stage) throws InterruptedException {
8282

8383
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.2
8484
@Override @Test
85-
public void unverified___spec202_blackbox_shouldAsynchronouslyDispatch() throws Exception {
85+
public void untested_spec202_blackbox_shouldAsynchronouslyDispatch() throws Exception {
8686
notVerified(); // cannot be meaningfully tested, or can it?
8787
}
8888

8989
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.3
9090
@Override @Test
91-
public void required___spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete() throws Throwable {
91+
public void required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete() throws Throwable {
9292
blackboxSubscriberWithoutSetupTest(new BlackboxTestStageTestRun() {
9393
@Override
9494
public void run(BlackboxTestStage stage) throws Throwable {
@@ -125,7 +125,7 @@ public void cancel() {
125125

126126
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.3
127127
@Override @Test
128-
public void required___spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublisherInOnError() throws Throwable {
128+
public void required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublisherInOnError() throws Throwable {
129129
blackboxSubscriberWithoutSetupTest(new BlackboxTestStageTestRun() {
130130
@Override
131131
public void run(BlackboxTestStage stage) throws Throwable {
@@ -164,13 +164,13 @@ public void cancel() {
164164

165165
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.4
166166
@Override @Test
167-
public void unverified___spec204_blackbox_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError() throws Exception {
167+
public void untested_spec204_blackbox_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError() throws Exception {
168168
notVerified(); // cannot be meaningfully tested, or can it?
169169
}
170170

171171
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.5
172172
@Override @Test
173-
public void required___spec205_blackbox_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal() throws Exception {
173+
public void required_spec205_blackbox_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal() throws Exception {
174174
new BlackboxTestStage(env) {{
175175
// try to subscribe another time, if the subscriber calls `probe.registerOnSubscribe` the test will fail
176176
final TestEnvironment.Latch secondSubscriptionCancelled = new TestEnvironment.Latch(env);
@@ -199,26 +199,26 @@ public String toString() {
199199

200200
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.6
201201
@Override @Test
202-
public void unverified___spec206_blackbox_mustCallSubscriptionCancelIfItIsNoLongerValid() throws Exception {
202+
public void untested_spec206_blackbox_mustCallSubscriptionCancelIfItIsNoLongerValid() throws Exception {
203203
notVerified(); // cannot be meaningfully tested, or can it?
204204
}
205205

206206
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.7
207207
@Override @Test
208-
public void unverified___spec207_blackbox_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization() throws Exception {
208+
public void untested_spec207_blackbox_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization() throws Exception {
209209
notVerified(); // cannot be meaningfully tested, or can it?
210210
// the same thread part of the clause can be verified but that is not very useful, or is it?
211211
}
212212

213213
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.8
214214
@Override @Test
215-
public void unverified___spec208_blackbox_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel() throws Throwable {
215+
public void untested_spec208_blackbox_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel() throws Throwable {
216216
notVerified(); // cannot be meaningfully tested as black box, or can it?
217217
}
218218

219219
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.9
220220
@Override @Test
221-
public void required___spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall() throws Throwable {
221+
public void required_spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall() throws Throwable {
222222
blackboxSubscriberWithoutSetupTest(new BlackboxTestStageTestRun() {
223223
@Override
224224
public void run(BlackboxTestStage stage) throws Throwable {
@@ -238,7 +238,7 @@ public void run(BlackboxTestStage stage) throws Throwable {
238238

239239
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.9
240240
@Override @Test
241-
public void required___spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall() throws Throwable {
241+
public void required_spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall() throws Throwable {
242242
blackboxSubscriberWithoutSetupTest(new BlackboxTestStageTestRun() {
243243
@Override
244244
public void run(BlackboxTestStage stage) throws Throwable {
@@ -262,7 +262,7 @@ public void subscribe(Subscriber<? super T> s) {
262262

263263
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.10
264264
@Override @Test
265-
public void required___spec210_blackbox_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall() throws Throwable {
265+
public void required_spec210_blackbox_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall() throws Throwable {
266266
blackboxSubscriberTest(new BlackboxTestStageTestRun() {
267267
@Override
268268
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
@@ -275,63 +275,63 @@ public void run(BlackboxTestStage stage) throws Throwable {
275275

276276
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.11
277277
@Override @Test
278-
public void unverified___spec211_blackbox_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents() throws Exception {
278+
public void untested_spec211_blackbox_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents() throws Exception {
279279
notVerified(); // cannot be meaningfully tested, or can it?
280280
}
281281

282282
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.12
283283
@Override @Test
284-
public void required___spec212_blackbox_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality() throws Throwable {
284+
public void untested_spec212_blackbox_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality() throws Throwable {
285285
notVerified(); // cannot be meaningfully tested as black box, or can it?
286286
}
287287

288288
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.13
289289
@Override @Test
290-
public void unverified___spec213_blackbox_failingOnSignalInvocation() throws Exception {
290+
public void untested_spec213_blackbox_failingOnSignalInvocation() throws Exception {
291291
notVerified(); // cannot be meaningfully tested, or can it?
292292
}
293293

294294
////////////////////// SUBSCRIPTION SPEC RULE VERIFICATION //////////////////
295295

296296
// Verifies rule: https://github.com/reactive-streams/reactive-streams#3.1
297297
@Override @Test
298-
public void unverified___spec301_blackbox_mustNotBeCalledOutsideSubscriberContext() throws Exception {
298+
public void untested_spec301_blackbox_mustNotBeCalledOutsideSubscriberContext() throws Exception {
299299
notVerified(); // cannot be meaningfully tested, or can it?
300300
}
301301

302302
// Verifies rule: https://github.com/reactive-streams/reactive-streams#3.8
303303
@Override @Test
304-
public void required___spec308_blackbox_requestMustRegisterGivenNumberElementsToBeProduced() throws Throwable {
304+
public void required_spec308_blackbox_requestMustRegisterGivenNumberElementsToBeProduced() throws Throwable {
305305
notVerified(); // cannot be meaningfully tested as black box, or can it?
306306
}
307307

308308
// Verifies rule: https://github.com/reactive-streams/reactive-streams#3.10
309309
@Override @Test
310-
public void unverified___spec310_blackbox_requestMaySynchronouslyCallOnNextOnSubscriber() throws Exception {
310+
public void untested_spec310_blackbox_requestMaySynchronouslyCallOnNextOnSubscriber() throws Exception {
311311
notVerified(); // cannot be meaningfully tested, or can it?
312312
}
313313

314314
// Verifies rule: https://github.com/reactive-streams/reactive-streams#3.11
315315
@Override @Test
316-
public void unverified___spec311_blackbox_requestMaySynchronouslyCallOnCompleteOrOnError() throws Exception {
316+
public void untested_spec311_blackbox_requestMaySynchronouslyCallOnCompleteOrOnError() throws Exception {
317317
notVerified(); // cannot be meaningfully tested, or can it?
318318
}
319319

320320
// Verifies rule: https://github.com/reactive-streams/reactive-streams#3.14
321321
@Override @Test
322-
public void unverified___spec314_blackbox_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists() throws Exception {
322+
public void untested_spec314_blackbox_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists() throws Exception {
323323
notVerified(); // cannot be meaningfully tested, or can it?
324324
}
325325

326326
// Verifies rule: https://github.com/reactive-streams/reactive-streams#3.15
327327
@Override @Test
328-
public void unverified___spec315_blackbox_cancelMustNotThrowExceptionAndMustSignalOnError() throws Exception {
328+
public void untested_spec315_blackbox_cancelMustNotThrowExceptionAndMustSignalOnError() throws Exception {
329329
notVerified(); // cannot be meaningfully tested, or can it?
330330
}
331331

332332
// Verifies rule: https://github.com/reactive-streams/reactive-streams#3.16
333333
@Override @Test
334-
public void unverified___spec316_blackbox_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber() throws Exception {
334+
public void untested_spec316_blackbox_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber() throws Exception {
335335
notVerified(); // cannot be meaningfully tested, or can it?
336336
}
337337

0 commit comments

Comments
 (0)