### Question:
Upstream { public boolean setOrCancel(Subscription incoming) { if (!SUBSCRIPTION.compareAndSet(this, null, incoming)) { incoming.cancel(); return false; } return true; } Upstream(); boolean setOrCancel(Subscription incoming); void request(long n); void cancel(); void clear();  }### Answer:
@Test void setOrCancel() { var s1 = new TestSubscription(); var ups = new Upstream(); assertTrue(ups.setOrCancel(s1)); var s2 = new TestSubscription(); assertFalse(ups.setOrCancel(s2)); assertEquals(1, s2.cancels); }