void (Set<Object> set) { assertTrue(set.isEmpty()); Ref<Object> ref = Ref.create(new Object()); set.add(ref.get()); GCWatcher.fromClearedRef(ref).ensureCollected(); assertFalse(set.remove(this)); // to run processQueue assertTrue(set.isEmpty()); assertTrue(set.add(this)); // to run processQueues(); //noinspection ConstantValue -- set contract is tested, not implied here assertFalse(set.isEmpty()); assertTrue(set.remove(this)); assertTrue(set.isEmpty()); //noinspection ConstantConditions assertEquals(0, set.size()); assertTrue(set.add(this)); assertEquals(1, set.size()); }