@Test
void whenOnlyListeningForExtendedStates_thenAtomicChangeReceivesAllExtendedStateDeletions() {

    cache.add(state1);
    cache.add(extended1);
    cache.add(state2);
    cache.add(extended2);
    List<Change> updates = new ArrayList<>();
    (new FilteringStateChangeListenable<>(cache, this::asExtended)).registerAtomicStateChangeListener(changes -> {
        result = true;
        changes.forEach(updates::add);
    });
    cache.updateAll(ImmutableList.of(
            Change.delete(state1),
            Change.delete(state2),
            Change.delete(extended1),
            Change.delete(extended2)));
    assertTrue(result);
    assertEquals(2, updates.size());
    assertEquals(extended1, updates.get(0).originalObject);
    assertNull(updates.get(0).newObject);
    assertEquals(extended2, updates.get(1).originalObject);
    assertNull(updates.get(0).newObject);
}