void () { String s1 = new String("foo"); String s2 = new String("bar"); ModalityStateEx state1 = new ModalityStateEx(Arrays.asList("common", s1)); ModalityStateEx state2 = new ModalityStateEx(Arrays.asList("common", s2)); assertNotEquals(state1, state2); GCWatcher watcher = GCWatcher.tracking(s1, s2); //noinspection UnusedAssignment s1 = s2 = null; watcher.ensureCollected(); assertNotEquals(state1, state2); }