@Test
public void testGetGroups() throws Exception {

    Group group1 = Mockito.mock(Group.class);
    Mockito.when(group1.getType()).thenReturn(Role.GROUP);
    Mockito.when(group1.getName()).thenReturn("group1");
    Mockito.when(userAdmin.getRoles("name=group1")).thenReturn(new Role[] { group1 });
    String[] groups = mbean.getGroups("name=group1");
    Assert.assertArrayEquals(new String[] { "group1" }, groups);
}