use of gov.cms.qpp.conversion.model.error.TransformException in project qpp-conversion-tool by CMSgov.
the class QualityMeasureIdRoundTripTest method testMeasureCMS52v5WithInsensitiveTextUuid.
@Test
void testMeasureCMS52v5WithInsensitiveTextUuid() {
Converter converter = new Converter(new PathSource(INSENSITIVE_TEXT_FILE));
List<Detail> details = new ArrayList<>();
try {
converter.transform();
} catch (TransformException exception) {
AllErrors errors = exception.getDetails();
details.addAll(errors.getErrors().get(0).getDetails());
}
assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).doesNotContain(ErrorCode.MEASURE_GUID_MISSING);
}
use of gov.cms.qpp.conversion.model.error.TransformException in project qpp-conversion-tool by CMSgov.
the class MarkupManipulationHandler method executeScenario.
public List<Detail> executeScenario(String xpath, boolean remove) {
InputStream inStream = manipulator.upsetTheNorm(xpath, remove);
Converter converter = new Converter(new InputStreamSupplierSource(xpath, inStream));
try {
converter.transform();
} catch (TransformException exception) {
AllErrors errors = exception.getDetails();
return errors.getErrors().stream().map(Error::getDetails).flatMap(List::stream).collect(Collectors.toList());
}
return Collections.emptyList();
}
use of gov.cms.qpp.conversion.model.error.TransformException in project qpp-conversion-tool by CMSgov.
the class ExceptionHandlerControllerV1Test method testTransformExceptionBody.
@Test
void testTransformExceptionBody() {
TransformException exception = new TransformException("test transform exception", new NullPointerException(), report);
ResponseEntity<AllErrors> responseEntity = objectUnderTest.handleTransformException(exception);
assertThat(responseEntity.getBody()).isEqualTo(allErrors);
}
use of gov.cms.qpp.conversion.model.error.TransformException in project qpp-conversion-tool by CMSgov.
the class ExceptionHandlerControllerV1Test method testTransformExceptionHeaderContentType.
@Test
void testTransformExceptionHeaderContentType() {
TransformException exception = new TransformException("test transform exception", new NullPointerException(), report);
ResponseEntity<AllErrors> responseEntity = objectUnderTest.handleTransformException(exception);
assertThat(responseEntity.getHeaders().getContentType()).isEquivalentAccordingToCompareTo(MediaType.APPLICATION_JSON_UTF8);
}
use of gov.cms.qpp.conversion.model.error.TransformException in project qpp-conversion-tool by CMSgov.
the class QrdaControllerV1Test method testFailedQppValidation.
@Test
void testFailedQppValidation() {
String transformationErrorMessage = "Test failed QPP validation";
when(qrdaService.convertQrda3ToQpp(any(Source.class))).thenReturn(null);
Mockito.doThrow(new TransformException(transformationErrorMessage, null, null)).when(validationService).validateQpp(isNull());
try {
ResponseEntity qppResponse = objectUnderTest.uploadQrdaFile(multipartFile, null);
Assertions.fail("An exception should have occurred. Instead was " + qppResponse);
} catch (TransformException exception) {
assertThat(exception.getMessage()).isEqualTo(transformationErrorMessage);
} catch (Exception exception) {
Assertions.fail("The wrong exception occurred.");
}
}
Aggregations