Search in sources :

Example 16 with PathSource

use of gov.cms.qpp.conversion.PathSource in project qpp-conversion-tool by CMSgov.

the class ExceptionHandlerControllerV1Test method setup.

@BeforeAll
static void setup() {
    Path path = Paths.get("../qrda-files/valid-QRDA-III-latest.xml");
    report = new Converter(new PathSource(path)).getReport();
    report.setReportDetails(allErrors);
}
Also used : Path(java.nio.file.Path) PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 17 with PathSource

use of gov.cms.qpp.conversion.PathSource in project qpp-conversion-tool by CMSgov.

the class AggregateCountFailureTest method testInvalidAggregateCounts.

@Test
void testInvalidAggregateCounts() throws IOException {
    // execute
    Converter converter = new Converter(new PathSource(Paths.get("src/test/resources/negative/angerTheConverter.xml")));
    String errorContent = "";
    try {
        converter.transform();
        Assertions.fail("A transformation exception must have been thrown!");
    } catch (TransformException exception) {
        AllErrors errors = exception.getDetails();
        ObjectWriter jsonObjectWriter = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL).writer().withDefaultPrettyPrinter();
        errorContent = jsonObjectWriter.writeValueAsString(errors);
    }
    // assert
    assertWithMessage("The error file flags a aggregate count type error").that(errorContent).contains(ErrorCode.NUMERATOR_DENOMINATOR_MUST_BE_INTEGER.format("Numerator").getMessage());
    assertWithMessage("The error file flags a aggregate count value error").that(errorContent).contains(ErrorCode.NUMERATOR_DENOMINATOR_INVALID_VALUE.format("Denominator").getMessage());
}
Also used : AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) PathSource(gov.cms.qpp.conversion.PathSource) TransformException(gov.cms.qpp.conversion.model.error.TransformException) Converter(gov.cms.qpp.conversion.Converter) ObjectWriter(com.fasterxml.jackson.databind.ObjectWriter) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.jupiter.api.Test)

Example 18 with PathSource

use of gov.cms.qpp.conversion.PathSource in project qpp-conversion-tool by CMSgov.

the class CpcQualityMeasureScopedValidatonTest method scopedConversion.

private Node scopedConversion(QrdaScope testSection, String path) {
    Converter converter = new Converter(new PathSource(baseDir.resolve(path)));
    converter.getContext().setScope(Sets.newHashSet(testSection));
    converter.transform();
    return converter.getReport().getDecoded().findFirstNode(TemplateId.MEASURE_REFERENCE_RESULTS_CMS_V2);
}
Also used : PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter)

Example 19 with PathSource

use of gov.cms.qpp.conversion.PathSource in project qpp-conversion-tool by CMSgov.

the class MeasureDataValidatorTest method multipleNegativeMeasureDataTest.

@Test
void multipleNegativeMeasureDataTest() throws Exception {
    // setup
    Path path = Paths.get("src/test/resources/negative/angerMeasureDataValidations.xml");
    // execute
    Converter converter = new Converter(new PathSource(path));
    AllErrors allErrors = new AllErrors();
    try {
        converter.transform();
    } catch (TransformException exception) {
        allErrors = exception.getDetails();
    }
    List<Detail> errors = getErrors(allErrors);
    assertWithMessage("Must contain the error").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsAllOf(ErrorCode.AGGREGATE_COUNT_VALUE_NOT_INTEGER, ErrorCode.AGGREGATE_COUNT_VALUE_NOT_SINGULAR, ErrorCode.MEASURE_DATA_VALUE_NOT_INTEGER);
}
Also used : Path(java.nio.file.Path) AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) PathSource(gov.cms.qpp.conversion.PathSource) 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 20 with PathSource

use of gov.cms.qpp.conversion.PathSource in project qpp-conversion-tool by CMSgov.

the class CpcTest method historicalFull.

@Test
void historicalFull() {
    Assertions.assertThrows(TransformException.class, () -> {
        Converter converter = new Converter(new PathSource(Paths.get(CPC_FILE)));
        converter.transform();
    });
}
Also used : PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter) Test(org.junit.jupiter.api.Test)

Aggregations

Converter (gov.cms.qpp.conversion.Converter)28 PathSource (gov.cms.qpp.conversion.PathSource)28 Test (org.junit.jupiter.api.Test)18 TransformException (gov.cms.qpp.conversion.model.error.TransformException)13 AllErrors (gov.cms.qpp.conversion.model.error.AllErrors)12 Path (java.nio.file.Path)9 JsonWrapper (gov.cms.qpp.conversion.encode.JsonWrapper)8 Detail (gov.cms.qpp.conversion.model.error.Detail)8 ArrayList (java.util.ArrayList)5 BeforeAll (org.junit.jupiter.api.BeforeAll)4 Map (java.util.Map)3 Context (gov.cms.qpp.conversion.Context)2 LocalizedError (gov.cms.qpp.conversion.model.error.LocalizedError)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1