WebRequestBuilder requestBuilder = mock(WebRequestBuilder.class, doReturnsThis());
@Test
public void shouldGet() throws Exception {
when(httpClient.request(path)).thenReturn(requestBuilder);
when(requestBuilder.get(HttpConnection.HTTP_OK, responseEntityType)).thenReturn(new ErrorMessageRepresentation());
ResourceRepresentation representation = restConnector.get(path, mediaType, responseEntityType);
assertThat(representation).isInstanceOf(ErrorMessageRepresentation.class);
}