Skip to content

Commit dc409bf

Browse files
ktosoviktorklang
authored andcommitted
=tck move back to inspecting subscription.isCompleted thanks to new impl
1 parent ae707a0 commit dc409bf

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,6 @@ public void expectNone(long withinMillis, String errMsgPrefix) throws Interrupte
572572

573573
public static class ManualSubscriberWithSubscriptionSupport<T> extends ManualSubscriber<T> {
574574

575-
private final AtomicBoolean onSubscribeCalled = new AtomicBoolean();
576-
577575
public ManualSubscriberWithSubscriptionSupport(TestEnvironment env) {
578576
super(env);
579577
}
@@ -591,7 +589,7 @@ public void onNext(T element) {
591589
@Override
592590
public void onComplete() {
593591
env.debug(this + "::onComplete()");
594-
if (onSubscribeCalled.get()) {
592+
if (subscription.isCompleted()) {
595593
super.onComplete();
596594
} else {
597595
env.flop("Subscriber::onComplete() called before Subscriber::onSubscribe");
@@ -603,7 +601,6 @@ public void onSubscribe(Subscription s) {
603601
env.debug(String.format("%s::onSubscribe(%s)", this, s));
604602
if (!subscription.isCompleted()) {
605603
subscription.complete(s);
606-
onSubscribeCalled.set(true);
607604
} else {
608605
env.flop("Subscriber::onSubscribe called on an already-subscribed Subscriber");
609606
}
@@ -612,7 +609,7 @@ public void onSubscribe(Subscription s) {
612609
@Override
613610
public void onError(Throwable cause) {
614611
env.debug(String.format("%s::onError(%s)", this, cause));
615-
if (onSubscribeCalled.get()) {
612+
if (subscription.isCompleted()) {
616613
super.onError(cause);
617614
} else {
618615
env.flop(cause, String.format("Subscriber::onError(%s) called before Subscriber::onSubscribe", cause));
@@ -806,7 +803,7 @@ public void expectCancelling() throws InterruptedException {
806803
public void expectCancelling(long timeoutMillis) throws InterruptedException {
807804
cancelled.expectClose(timeoutMillis, "Did not receive expected cancelling of upstream subscription");
808805
}
809-
806+
810807
public boolean isCancelled() throws InterruptedException {
811808
return cancelled.isClosed();
812809
}

0 commit comments

Comments
 (0)