@Test
public void testPutPublicKeyEntry() {

    ZMSClient client = createClient(systemAdminUser);
    ZMSRDLGeneratedClient c = Mockito.mock(ZMSRDLGeneratedClient.class);
    client.setZMSRDLGeneratedClient(c);
    PublicKeyEntry keyEntry = new PublicKeyEntry();
    PublicKeyEntry keyEntryMock = Mockito.mock(PublicKeyEntry.class);
    Mockito.when(c.putPublicKeyEntry("PutPublicKeyDom2", "Service1", "zone2", AUDIT_REF, keyEntry)).thenReturn(keyEntryMock);
    client.putPublicKeyEntry("PutPublicKeyDom2", "Service1", "zone2", AUDIT_REF, keyEntry);
    try {
        Mockito.when(c.putPublicKeyEntry("PutPublicKeyDom3", "Service2", "zone2", AUDIT_REF, keyEntry)).thenThrow(new ResourceException(204));
        client.putPublicKeyEntry("PutPublicKeyDom3", "Service2", "zone2", AUDIT_REF, keyEntry);
        fail();
    } catch  (ResourceException ex) {
        assertTrue(true);
    }
    try {
        Mockito.when(client.client.putPublicKeyEntry("domain1", "Service1", "0", AUDIT_REF, keyEntry)).thenThrow(new NullPointerException());
        client.putPublicKeyEntry("domain1", "Service1", "0", AUDIT_REF, keyEntry);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
    }
}