@Test
    public void testUpdateEventsInWrongOrder() throws Exception
    {
        // Setup text fixture, Simulating things for a cache with this signature: Cache<String, Set<NodeID>> cache;
        final Map<NodeID, Set<String>> reverseLookupMap = new HashMap<>();
        final Function<HashSet<NodeID>, Set<NodeID>> deducer = nodeIDS -> nodeIDS;
        final ReverseLookupComputingCacheEntryListener<String, HashSet<NodeID>> listener = new ReverseLookupComputingCacheEntryListener<>(reverseLookupMap, deducer);
        final NodeID clusterNodeA = NodeID.getInstance(UUID.randomUUID().toString().getBytes());
        final NodeID clusterNodeB = NodeID.getInstance(UUID.randomUUID().toString().getBytes());

        // Execute system under test.
        listener.entryUpdated("somekey", new HashSet<>(List.of(clusterNodeA)), new HashSet<>(Arrays.asList(clusterNodeA, clusterNodeB)), clusterNodeB);
        listener.entryAdded("somekey", new HashSet<>(List.of(clusterNodeA)), clusterNodeA);

        // Assert result
        assertTrue(reverseLookupMap.containsKey(clusterNodeA));
        assertTrue(reverseLookupMap.get(clusterNodeA).contains("somekey"));
        assertTrue(reverseLookupMap.containsKey(clusterNodeB));
        assertTrue(reverseLookupMap.get(clusterNodeB).contains("somekey"));
    }
Simulates a scenario where one cluster node adds an entry to an otherwise empty cache, followed by another
cluster node updating that entry, adding itself as another 'owner' of the entry, where the events that are
generated by these actions arrive in the reversed order (which, as this is an async operation, can occur).
xmppserver/src/test/java/org/jivesoftware/util/cache/ReverseLookupComputingCacheEntryListenerTest.java