@Test
public void testAddRequiredMember() throws IOException {

    Group group1 = Mockito.mock(Group.class);
    User user1 = Mockito.mock(User.class);
    Mockito.when(userAdmin.getRole("group1")).thenReturn(group1);
    Mockito.when(userAdmin.getRole("user1")).thenReturn(user1);
    Mockito.when(group1.getType()).thenReturn(Role.GROUP);
    Mockito.when(group1.addRequiredMember(user1)).thenReturn(true);
    boolean isAdded = mbean.addRequiredMember("group1", "user1");
    Assert.assertTrue(isAdded);
    Mockito.verify(group1).addRequiredMember(user1);
}