@Test
void whenOnlyListeningForExtendedStates_thenAddOrRemovedOnlyReceivedExtendedStates() {

    (new FilteringStateChangeListenable<>(cache, this::asExtended)).registerStateAddedOrRemovedListener(s -> {
        result = true;
        resultUpdated = s;
    });
    cache.add(state1);
    assertFalse(result);
    cache.add(extended1);
    assertTrue(result);
    assertEquals(extended1, resultUpdated);
    resetResult();
    // Check that add+remove doesn't fire on updates
    cache.update(state1, state1Updated);
    assertFalse(result);
    cache.update(extended1, extended1Updated);
    assertFalse(result);
    // Check that add+remove fires on removals
    cache.delete(state1Updated.getId());
    assertFalse(result);
    cache.delete(extended1Updated.getId());
    assertTrue(result);
    assertEquals(extended1Updated, resultUpdated);
}