Skip to content

Commit ee3408e

Browse files
committed
Fixed #188 by making 2.12 an unverified rule, as it cannot be deterministically verified.
1 parent b4f359f commit ee3408e

6 files changed

+8
-46
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,8 @@ public void unverified___spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBefor
541541
}
542542

543543
@Override @Test
544-
public void optional___spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation() throws Throwable {
545-
subscriberVerification.optional___spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation();
544+
public void unverified___spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation() throws Throwable {
545+
subscriberVerification.unverified___spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation();
546546
}
547547

548548
@Override @Test

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public void unverified___spec211_blackbox_mustMakeSureThatAllCallsOnItsMethodsHa
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 unverified___spec212_blackbox_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality() throws Throwable {
285285
notVerified(); // cannot be meaningfully tested as black box, or can it?
286286
}
287287

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

+2-24
Original file line numberDiff line numberDiff line change
@@ -342,30 +342,8 @@ public void unverified___spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBefor
342342

343343
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.12
344344
@Override @Test
345-
public void optional___spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation() throws Throwable {
346-
optionalSubscriberTestWithoutSetup(new TestStageTestRun() {
347-
@Override @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
348-
public void run(WhiteboxTestStage stage) throws Exception {
349-
stage.pub = stage.createHelperPublisher(1);
350-
351-
stage.tees = new ManualSubscriberWithSubscriptionSupport<T>(env);
352-
353-
env.subscribe(stage.pub, stage.tees);
354-
stage.tees.expectNone();
355-
356-
// subscribe the same subscriber again,
357-
// this can not use convinience subscribe(pub, sub), because that one checks for noAsyncErrors
358-
// instead we expect the error afterwards
359-
stage.pub.subscribe(stage.tees); // NOTE: This is a spec violation!
360-
361-
// NOTE: It would be nice to signal an error in response to such spec violation, however
362-
// reacting to spec violations is not strictly regulated by the Spec - for example, just logging and ignoring may
363-
// also be a valid response to this spec violation - it's up to the implementation
364-
//
365-
// The TCK is able to check only for onErroring in such case, thus the check below and the optional nature of this test
366-
stage.tees.expectError(Exception.class, "Should not allow subscribing the same instance multiple times, see Reactive Streams Specification Rule 2.12");
367-
}
368-
});
345+
public void unverified___spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation() throws Throwable {
346+
notVerified(); // cannot be meaningfully tested, or can it?
369347
}
370348

371349
// Verifies rule: https://github.com/reactive-streams/reactive-streams#2.13

tck/src/main/java/org/reactivestreams/tck/support/SubscriberBlackboxVerificationRules.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public interface SubscriberBlackboxVerificationRules {
1818
void required___spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall() throws Throwable;
1919
void required___spec210_blackbox_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall() throws Throwable;
2020
void unverified___spec211_blackbox_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents() throws Exception;
21-
void required___spec212_blackbox_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality() throws Throwable;
21+
void unverified___spec212_blackbox_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality() throws Throwable;
2222
void unverified___spec213_blackbox_failingOnSignalInvocation() throws Exception;
2323
void unverified___spec301_blackbox_mustNotBeCalledOutsideSubscriberContext() throws Exception;
2424
void required___spec308_blackbox_requestMustRegisterGivenNumberElementsToBeProduced() throws Throwable;

tck/src/main/java/org/reactivestreams/tck/support/SubscriberWhiteboxVerificationRules.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public interface SubscriberWhiteboxVerificationRules {
2020
void required___spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall() throws Throwable;
2121
void required___spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall() throws Throwable;
2222
void unverified___spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents() throws Exception;
23-
void optional___spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation() throws Throwable;
23+
void unverified___spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation() throws Throwable;
2424
void unverified___spec213_failingOnSignalInvocation() throws Exception;
2525
void unverified___spec301_mustNotBeCalledOutsideSubscriberContext() throws Exception;
2626
void required___spec308_requestMustRegisterGivenNumberElementsToBeProduced() throws Throwable;

tck/src/test/java/org/reactivestreams/tck/SubscriberWhiteboxVerificationTest.java

+1-17
Original file line numberDiff line numberDiff line change
@@ -283,23 +283,7 @@ public Subscriber<Integer> apply(WhiteboxSubscriberProbe<Integer> probe) throws
283283
}
284284
}, "Test Exception: Boom!"); // checks that the expected exception was delivered to onError, we don't expect anyone to implement onError so weirdly
285285
}
286-
287-
@Test
288-
public void optional___spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_shouldFail_ifItAcceptsTheSameSubscriberMoreTimes() throws Throwable {
289-
requireTestFailure(new ThrowingRunnable() {
290-
@Override public void run() throws Throwable {
291-
292-
customSubscriberVerification(new Function<WhiteboxSubscriberProbe<Integer>, Subscriber<Integer>>() {
293-
@Override
294-
public Subscriber<Integer> apply(WhiteboxSubscriberProbe<Integer> probe) throws Throwable {
295-
return new SimpleSubscriberWithProbe(probe) {
296-
};
297-
}
298-
}).optional___spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation();
299-
}
300-
}, "");
301-
}
302-
286+
303287
@Test
304288
public void required___spec308_requestMustRegisterGivenNumberElementsToBeProduced_shouldFail() throws Throwable {
305289
// sanity checks the "happy path", that triggerRequest() propagates the right demand

0 commit comments

Comments
 (0)