@Test
    public void testGroupSharingSingle() throws Exception
    {
        // Setup test fixture.
        final String groupName = "unit-test-group-sharing-single";
        final String groupNameSharedWith = "unit-test-group-sharedWith";
        final Group group = groupManager.createGroup(groupName);
        final Group groupSharedWith = groupManager.createGroup(groupNameSharedWith);

        // Execute system under test.
        group.shareWithUsersInGroups(List.of(groupSharedWith.getName()), "TestGroupSharing");

        // Verify results.
        List<String> sharedWithGroups = group.getSharedWithUsersInGroupNames();
        assertEquals( sharedWithGroups.size(), 2);
        assertTrue(sharedWithGroups.contains(groupName));
        assertTrue(sharedWithGroups.contains(groupNameSharedWith));
    }
Verifies that when a group is explicitly shared with 1 other group, that it is then shared with that group and itself
xmppserver/src/test/java/org/jivesoftware/openfire/group/GroupTest.java