@Test
public void shouldIncludeExistingErrorMessageInExceptionWhenStatusIsNotAsExpected() throws Exception {
// Given
when(response.getStatus()).thenReturn(ERROR_STATUS);
ErrorMessageRepresentation errorRepresentation = new ErrorMessageRepresentation();
when(response.hasEntity()).thenReturn(true);
when(response.getEntity(ErrorMessageRepresentation.class)).thenReturn(errorRepresentation);
// Then
thrown.expect(SDKException.class);
thrown.expectMessage("Http status code: " + ERROR_STATUS + "\n" + errorRepresentation.toString());
// When
parser.parse(response, EXPECTED_STATUS, BaseResourceRepresentation.class);
}