@Test
public void testUpdatePrincipal() {

    String zmsUrl = getZMSUrl();
    ZMSClient client = new ZMSClient(zmsUrl);
    ZMSRDLGeneratedClient c = Mockito.mock(ZMSRDLGeneratedClient.class);
    Domain domain = new Domain().setName("domain");
    Mockito.when(c.getDomain("domain")).thenReturn(domain);
    UserToken userToken = new UserToken().setHeader("Header").setToken("Token");
    Mockito.when(c.getUserToken("joe", null, true)).thenReturn(userToken);
    client.setZMSRDLGeneratedClient(c);
    assertNotNull(client);
    // add credentials
    Authority authority = new com.yahoo.athenz.auth.impl.UserAuthority();
    Principal p = SimplePrincipal.create("user", "joe", "v=U1;d=user;n=joe;s=signature",
            0, authority);
    client.addCredentials(p);
    assertNotNull(client.getDomain("domain"));
    assertNotNull(client.getDomain("domain"));
}