@Test
public void testGetRoles() throws Exception {

    User user1 = Mockito.mock(User.class);
    Mockito.when(user1.getType()).thenReturn(Role.USER);
    Mockito.when(user1.getName()).thenReturn("user1");
    Mockito.when(userAdmin.getRoles("name=user1")).thenReturn(new Role[] { user1 });
    String[] roles = mbean.getRoles("name=user1");
    Assert.assertArrayEquals(new String[] { "user1" }, roles);
}