public void testSharedGroupNamesByNameStaleCacheTestMemberRemoved() throws Exception
    {
        // Setup test fixture.
        final JID needle = new JID("jane@example.org");
        final DefaultGroupProvider provider = new DefaultGroupProvider();
        final Group group = provider.createGroup("Test Group A");
        group.shareWithUsersInSameGroup("Users in Group A");
        group.getMembers().add(needle);

        // Execute system under test.
        provider.getSharedGroupNames(needle); // populate cache
        group.getMembers().remove(needle);
        final Collection<String> result = provider.getSharedGroupNames(needle);

        // Verify result.
        assertEquals(0, result.size());
    }
Verifies that a {@link AbstractGroupProvider#getSharedGroupNames(JID)} does not return a stale cache test when
a member is removed from a shared group after the group as already loaded in a cache.
xmppserver/src/test/java/org/jivesoftware/openfire/group/AbstractGroupProviderTest.java