@Test
public void testDeleteGroup() {

    final String domainName = "del-group";
    final String groupName1 = "group1";
    final String groupName2 = "group2";
    final String groupName3 = "group3";
    ZMSClient client = createClient(systemAdminUser);
    ZMSRDLGeneratedClient c = Mockito.mock(ZMSRDLGeneratedClient.class);
    client.setZMSRDLGeneratedClient(c);
    Group groupMock = Mockito.mock(Group.class);
    Mockito.when(c.deleteGroup(domainName, groupName1, AUDIT_REF)).thenReturn(groupMock);
    client.deleteGroup(domainName, groupName1, AUDIT_REF);
    try {
        Mockito.when(c.deleteGroup(domainName, groupName2, AUDIT_REF)).thenThrow(new ResourceException(204));
        client.deleteGroup(domainName, groupName2, AUDIT_REF);
        fail();
    } catch  (ResourceException ex) {
        assertEquals(ex.getCode(), 204);
    }
    try {
        Mockito.when(c.deleteGroup(domainName, groupName3, AUDIT_REF)).thenThrow(new NullPointerException());
        client.deleteGroup(domainName, groupName3, AUDIT_REF);
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
    }
}