### Question:
Upstream { public void cancel() { Subscription currentSubscription = (Subscription) SUBSCRIPTION.getAndSet(this, FlowSupport.NOOP_SUBSCRIPTION); if (currentSubscription != null) { currentSubscription.cancel(); } } Upstream(); boolean setOrCancel(Subscription incoming); void request(long n); void cancel(); void clear();  }### Answer:
@Test void cancel() { var s = new TestSubscription(); var ups = new Upstream(); assertTrue(ups.setOrCancel(s)); ups.cancel(); assertEquals(1, s.cancels); }