@Test
    public void testAdd() 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<Set<NodeID>, Set<NodeID>> deducer = nodeIDS -> nodeIDS;
        final ReverseLookupComputingCacheEntryListener<String, Set<NodeID>> listener = new ReverseLookupComputingCacheEntryListener<>(reverseLookupMap, deducer);
        final NodeID clusterNode = NodeID.getInstance(UUID.randomUUID().toString().getBytes());

        // Execute system under test.
        listener.entryAdded("somekey", Collections.singleton(clusterNode), clusterNode);

        // Assert result
        assertTrue(reverseLookupMap.containsKey(clusterNode));
        assertTrue(reverseLookupMap.get(clusterNode).contains("somekey"));
    }
Simulates a scenario where one cluster node adds an entry to an otherwise empty cache.
xmppserver/src/test/java/org/jivesoftware/util/cache/ReverseLookupComputingCacheEntryListenerTest.java