Search in sources :

Example 11 with AllErrors

use of gov.cms.qpp.conversion.model.error.AllErrors in project qpp-conversion-tool by CMSgov.

the class QualityMeasureIdRoundTripTest method testMeasureCMS160v5PerformanceRateUuid.

@Test
void testMeasureCMS160v5PerformanceRateUuid() {
    Converter converter = new Converter(new PathSource(INVALID_PERFORMANCE_UUID_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).contains(ErrorCode.QUALITY_MEASURE_ID_MISSING_SINGLE_PERFORMANCE_RATE);
}
Also used : AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) PathSource(gov.cms.qpp.conversion.PathSource) ArrayList(java.util.ArrayList) TransformException(gov.cms.qpp.conversion.model.error.TransformException) Converter(gov.cms.qpp.conversion.Converter) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 12 with AllErrors

use of gov.cms.qpp.conversion.model.error.AllErrors 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);
}
Also used : AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) PathSource(gov.cms.qpp.conversion.PathSource) ArrayList(java.util.ArrayList) TransformException(gov.cms.qpp.conversion.model.error.TransformException) Converter(gov.cms.qpp.conversion.Converter) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 13 with AllErrors

use of gov.cms.qpp.conversion.model.error.AllErrors 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();
}
Also used : InputStream(java.io.InputStream) AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) TransformException(gov.cms.qpp.conversion.model.error.TransformException) Converter(gov.cms.qpp.conversion.Converter) InputStreamSupplierSource(gov.cms.qpp.conversion.InputStreamSupplierSource) List(java.util.List)

Example 14 with AllErrors

use of gov.cms.qpp.conversion.model.error.AllErrors in project qpp-conversion-tool by CMSgov.

the class QrdaServiceImplTest method testConvertQrda3ToQppError.

@Test
void testConvertQrda3ToQppError() {
    TransformException exception = assertThrows(TransformException.class, () -> objectUnderTest.convertQrda3ToQpp(MOCK_ERROR_QRDA_SOURCE));
    AllErrors allErrors = exception.getDetails();
    assertThat(allErrors.getErrors().get(0).getSourceIdentifier()).isSameAs(MOCK_ERROR_SOURCE_IDENTIFIER);
}
Also used : AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) TransformException(gov.cms.qpp.conversion.model.error.TransformException) Test(org.junit.jupiter.api.Test)

Example 15 with AllErrors

use of gov.cms.qpp.conversion.model.error.AllErrors in project qpp-conversion-tool by CMSgov.

the class ConversionFileWriterWrapper method executeConverter.

/**
 * Execute the converter and do initial handling of the result.
 *
 * @param converter The Converter to execute.
 */
private void executeConverter(Converter converter) {
    try {
        JsonWrapper jsonWrapper = converter.transform();
        Path outFile = getOutputFile(source.getName(), true);
        DEV_LOG.info("Successful conversion.  Writing out QPP to {}", outFile.toString());
        writeOutQpp(jsonWrapper, outFile);
    } catch (TransformException exception) {
        AllErrors allErrors = exception.getDetails();
        Path outFile = getOutputFile(source.getName(), false);
        DEV_LOG.warn("There were errors during conversion.  Writing out errors to " + outFile.toString(), exception);
        writeOutErrors(allErrors, outFile);
    }
}
Also used : Path(java.nio.file.Path) JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) TransformException(gov.cms.qpp.conversion.model.error.TransformException)

Aggregations

AllErrors (gov.cms.qpp.conversion.model.error.AllErrors)31 TransformException (gov.cms.qpp.conversion.model.error.TransformException)21 Test (org.junit.jupiter.api.Test)19 Converter (gov.cms.qpp.conversion.Converter)15 PathSource (gov.cms.qpp.conversion.PathSource)12 Detail (gov.cms.qpp.conversion.model.error.Detail)11 Path (java.nio.file.Path)8 ArrayList (java.util.ArrayList)6 Error (gov.cms.qpp.conversion.model.error.Error)4 QppValidationException (gov.cms.qpp.conversion.model.error.QppValidationException)4 LocalizedError (gov.cms.qpp.conversion.model.error.LocalizedError)3 Truth.assertThat (com.google.common.truth.Truth.assertThat)2 Context (gov.cms.qpp.conversion.Context)2 InputStreamSupplierSource (gov.cms.qpp.conversion.InputStreamSupplierSource)2 XmlException (gov.cms.qpp.conversion.xml.XmlException)2 XmlUtils (gov.cms.qpp.conversion.xml.XmlUtils)2 AcceptanceTest (gov.cms.qpp.test.annotations.AcceptanceTest)2 RestAssured.given (io.restassured.RestAssured.given)2 Response (io.restassured.response.Response)2 InputStream (java.io.InputStream)2