@Test
public void apiGet_FailWithUnexpectedStatusCode() throws Exception {

    try {
        RangerRESTClient restClient = mock(RangerRESTClient.class);
        ClientResponse   response   = mock(ClientResponse.class);
        RangerClient     client     = new RangerClient(restClient);
        when(restClient.get(anyString(), any())).thenReturn(response);
        when(response.getStatus()).thenReturn(ClientResponse.Status.INTERNAL_SERVER_ERROR.getStatusCode());
        client.getService(1L);
        Assert.fail("supposed to fail with RangerServiceException");
    } catch(RangerServiceException excp) {
        Assert.assertTrue(excp.getMessage().contains("statusCode=" + ClientResponse.Status.INTERNAL_SERVER_ERROR.getStatusCode()));
        Assert.assertTrue(excp.getMessage().contains("status=" + ClientResponse.Status.INTERNAL_SERVER_ERROR.getReasonPhrase()));
    }
}