@Test
public void testVisitor()
{

    Group group1 = createGroup("employees", "Employees", null);
    Group group2 = createGroup("developers", "Developers", group1);
    Group group3 = createGroup("java-developers-uk", "Java Developers UK", group2);
    Set<Group> nestedGroups = new LinkedHashSet<>();
    ParentGroupVisitor visitor = new ParentGroupVisitor();
    try
    {
        visitor.visit(group3, nestedGroups);
        for (Group group : nestedGroups)
        {
            System.out.println(group.getName());
        }
    }
    catch (NotSupportedException e)
    {
        e.printStackTrace();
    }
}