@Test
    public void testUpdateForUnique() throws Exception
    {
        final ConcurrentMap<NodeID, Set<String>> reverseLookupMap = new ConcurrentHashMap<>();
        final ReverseLookupUpdatingCacheEntryListener<String, Set<NodeID>> listener = new ReverseLookupUpdatingCacheEntryListener<>(reverseLookupMap, true);
        final NodeID clusterNode = NodeID.getInstance(UUID.randomUUID().toString().getBytes());

        // Execute system under test.
        listener.entryAdded("somekey", null, clusterNode);
        listener.entryUpdated("somekey", null, null, clusterNode);

        // Assert result
        assertTrue(reverseLookupMap.containsKey(clusterNode) && reverseLookupMap.get(clusterNode).contains("somekey"));
    }
Simulates a scenario where a cluster node adds an entry to an otherwise empty cache, followed by an update of
that entry, with a listener that does not allow for entries to be owned by more than one cluster node.

In this scenario, the event listeners are fired in the same order as the order in which the insertions occur.
Due to the asynchronous behavior, this is not guaranteed to occur (see #testUpdateForUniqueInWrongOrder).
xmppserver/src/test/java/org/jivesoftware/util/cache/ReverseLookupUpdatingCacheEntryListenerTest.java