SuspendableYes extends SuspendableBoolean { @Override public boolean get() { return !isSuspended(); }  @Override boolean get();  }
@Test public void recursionTest() { SuspendableYes sy = new SuspendableYes(); sy.addListener((ind, oldVal, newVal) -> { if(!newVal) { sy.suspend(); } }); List<Tuple2<Boolean, Boolean>> changes = new ArrayList<>(); EventStreams.changesOf(sy) .subscribe(ch -> changes.add(t(ch.getOldValue(), ch.getNewValue()))); sy.suspend().close(); for(Tuple2<Boolean, Boolean> ch: changes) { assertNotEquals(ch._1, ch._2); } for(int i = 0; i < changes.size() - 1; ++i) { assertEquals( "changes[" + i + "] = " + changes.get(i) + " and changes[" + (i+1) + "] = " + changes.get(i+1) + " are not compatible", changes.get(i)._2, changes.get(i+1)._1); } }