@Test
public void testListUsers() throws Exception {

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