@Test
public void createMessageWithErrorStatusShouldCreateErrorResponseWithEntity() {

    Response errorResponse = JSONResponse.createResponse(Status.INTERNAL_SERVER_ERROR, ENTITY_VALUE, "error");
    assertThat(errorResponse.getMediaType(), is(MediaType.APPLICATION_JSON_TYPE));
    assertThat(errorResponse.getStatus(), is(500));
    JsonObject resultJson = (JsonObject) errorResponse.getEntity();
    assertThat(resultJson.get(JSONResponse.JSON_KEY_ENTITY).getAsString(), is(ENTITY_VALUE));
    JsonObject errorJson = resultJson.get(JSONResponse.JSON_KEY_ERROR).getAsJsonObject();
    assertThat(errorJson.get(JSONResponse.JSON_KEY_ERROR_MESSAGE).getAsString(), is("error"));
    assertThat(errorJson.get(JSONResponse.JSON_KEY_HTTPCODE).getAsInt(), is(500));
}