use of org.simbasecurity.dwclient.exception.mapper.SimbaUnavailableExceptionToJSONMapper in project simba-os by cegeka.
the class SimbaUnavailableExceptionToJSONMapperTest method toResponse_ReturnsJSONValidationError.
@Test
public void toResponse_ReturnsJSONValidationError() throws Exception {
SimbaUnavailableExceptionToJSONMapper mapperUnderTest = new SimbaUnavailableExceptionToJSONMapper();
SimbaUnavailableException simbaUnavailableException = new SimbaUnavailableException();
DWSimbaErrorR expectedEntity = new DWSimbaErrorR(HttpStatus.INTERNAL_SERVER_ERROR.getDescription(), SimbaUnavailableExceptionToJSONMapper.SIMBA_ERROR_MESSAGE, null);
MediaType expectedMediaType = MediaType.APPLICATION_JSON_TYPE;
int expectedStatus = 500;
Response actual = mapperUnderTest.toResponse(simbaUnavailableException);
assertThat(actual.getStatus()).isEqualTo(expectedStatus);
assertThat((MediaType) actual.getMetadata().get("Content-Type").get(0)).isEqualTo(expectedMediaType);
assertThat(actual.getEntity()).isEqualsToByComparingFields(expectedEntity);
}
Aggregations