### Question:
ErrorMapper { public static ErrorStatusInfo mapError(final Exception exception, final Map<String, Integer> httpResponseCodeMappings, final Integer defaultResponseCode) { SyndesisConnectorException sce; if (isOrCausedBySyndesisConnectorException(exception)) { sce = extract(exception); } else { sce = fromRuntimeException(exception, httpResponseCodeMappings.keySet()); } if (sce == null) { sce = SyndesisConnectorException.from(exception); } Integer responseCode = httpResponseCodeMappings.get(sce.getCategory()) != null ? httpResponseCodeMappings.get(sce.getCategory()): defaultResponseCode; return new ErrorStatusInfo(responseCode, sce.getCategory(), Optional.ofNullable(sce.getMessage()).orElse("no message"), deriveErrorName(sce)); } private  ErrorMapper(); static Map<String, Integer> jsonToMap(String property); static ErrorStatusInfo mapError(final Exception exception, final Map<String, Integer> httpResponseCodeMappings,
            final Integer defaultResponseCode);  }### Answer:
@Test public void testEmptyMap() { SyndesisConnectorException sce = new SyndesisConnectorException("SQL_CONNECTOR_ERROR", "error msg test"); ErrorStatusInfo info = ErrorMapper.mapError(sce, Collections.emptyMap(), 200); assertThat(info.getHttpResponseCode()).isEqualTo(200); assertThat(info.getCategory()).isEqualTo("SQL_CONNECTOR_ERROR"); assertThat(info.getMessage()).isEqualTo("error msg test"); }
@Test public void testSyndesisEntityNotFOund() { Exception e = new SyndesisConnectorException("SQL_ENTITY_NOT_FOUND_ERROR", "entity not found"); ErrorStatusInfo info = ErrorMapper.mapError(e, errorResponseCodeMappings, 200); assertThat(info.getHttpResponseCode()).isEqualTo(404); assertThat(info.getCategory()).isEqualTo("SQL_ENTITY_NOT_FOUND_ERROR"); assertThat(info.getMessage()).isEqualTo("entity not found"); }
@Test public void testUnmappedException() { Exception e = new Exception("Unmapped Exception"); ErrorStatusInfo info = ErrorMapper.mapError(e, errorResponseCodeMappings, 200); assertThat(info.getHttpResponseCode()).isEqualTo(500); assertThat(info.getCategory()).isEqualTo(ErrorCategory.SERVER_ERROR); assertThat(info.getMessage()).isEqualTo("Unmapped Exception"); }
@Test public void testFileAlreadyExistsException() { Exception e = new FileAlreadyExistsException("myfile"); ErrorStatusInfo info = ErrorMapper.mapError(e, errorResponseCodeMappings, 200); assertThat(info.getHttpResponseCode()).isEqualTo(500); assertThat(info.getCategory()).isEqualTo("SERVER_ERROR"); assertThat(info.getMessage()).isEqualTo("myfile"); assertThat(info.getError()).isEqualTo("file_already_exists_error"); }