@Test
public void testRemoveCredential() throws IOException {

    User user1 = Mockito.mock(User.class);
    Dictionary<String, Object> cred = new Hashtable<String, Object>();
    Mockito.when(userAdmin.getRole("user1")).thenReturn(user1);
    Mockito.when(user1.getType()).thenReturn(Role.USER);
    Mockito.when(user1.getCredentials()).thenReturn(cred);
    mbean.removeCredential("key", "user1");
    Assert.assertEquals(0, cred.size());
}