Search in sources :

Example 31 with Converter

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

the class QualityMeasureIdMultiRoundTripTest method executeScenario.

private List<Detail> executeScenario(String path, boolean remove) {
    InputStream modified = manipulator.upsetTheNorm(path, remove);
    Converter converter = new Converter(new InputStreamSupplierSource(JUNK_QRDA3_FILE.toString(), modified));
    List<Detail> details = new ArrayList<>();
    try {
        converter.transform();
    } catch (TransformException exception) {
        AllErrors errors = exception.getDetails();
        details.addAll(errors.getErrors().get(0).getDetails());
    }
    return details;
}
Also used : InputStream(java.io.InputStream) AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) ArrayList(java.util.ArrayList) TransformException(gov.cms.qpp.conversion.model.error.TransformException) Converter(gov.cms.qpp.conversion.Converter) InputStreamSupplierSource(gov.cms.qpp.conversion.InputStreamSupplierSource) Detail(gov.cms.qpp.conversion.model.error.Detail)

Example 32 with Converter

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

the class QualityMeasureIdMultiRoundTripTest method testRoundTripQualityMeasureIdWithDenomGreaterThanIpop.

@Test
void testRoundTripQualityMeasureIdWithDenomGreaterThanIpop() {
    Converter converter = new Converter(new PathSource(DENOM_GREATER_THAN_IPOP));
    List<Detail> details = new ArrayList<>();
    try {
        converter.transform();
    } catch (TransformException exception) {
        AllErrors errors = exception.getDetails();
        details.addAll(errors.getErrors().get(0).getDetails());
    }
    assertThat(details).hasSize(3);
    assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).contains(ErrorCode.DENOMINATOR_COUNT_INVALID);
}
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 33 with Converter

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

the class QualityMeasureIdRoundTripTest method testMeasureCMS68v6PerformanceRateUuid.

@Test
void testMeasureCMS68v6PerformanceRateUuid() {
    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());
    }
    String measureId = "CMS68v6";
    String correctId = MeasureConfigs.getConfigurationMap().get("40280381-52fc-3a32-0153-3d64af97147b").getSubPopulation().get(0).getNumeratorUuid();
    LocalizedError error = ErrorCode.QUALITY_MEASURE_ID_INCORRECT_UUID.format(measureId, PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE_ID, correctId);
    assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).contains(error);
}
Also used : AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) PathSource(gov.cms.qpp.conversion.PathSource) LocalizedError(gov.cms.qpp.conversion.model.error.LocalizedError) 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 34 with Converter

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

the class AciMeasurePerformedRoundTripTest method testGarbage.

@Test
void testGarbage() {
    Converter converter = new Converter(new PathSource(JUNK_QRDA3_FILE));
    JsonWrapper qpp = converter.transform();
    List<Map<String, ?>> aciMeasures = JsonHelper.readJsonAtJsonPath(qpp.toString(), "$.measurementSets[?(@.category=='aci')].measurements[?(@.measureId=='TEST_MEASURE_ID')]", List.class);
    assertThat(aciMeasures).hasSize(1);
    assertThat((aciMeasures.get(0).get("measureId"))).isEqualTo("TEST_MEASURE_ID");
}
Also used : JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Aggregations

Converter (gov.cms.qpp.conversion.Converter)34 PathSource (gov.cms.qpp.conversion.PathSource)28 Test (org.junit.jupiter.api.Test)18 TransformException (gov.cms.qpp.conversion.model.error.TransformException)16 AllErrors (gov.cms.qpp.conversion.model.error.AllErrors)15 JsonWrapper (gov.cms.qpp.conversion.encode.JsonWrapper)9 Detail (gov.cms.qpp.conversion.model.error.Detail)9 Path (java.nio.file.Path)9 ArrayList (java.util.ArrayList)6 BeforeAll (org.junit.jupiter.api.BeforeAll)4 Map (java.util.Map)3 Context (gov.cms.qpp.conversion.Context)2 ConversionReport (gov.cms.qpp.conversion.ConversionReport)2 InputStreamSupplierSource (gov.cms.qpp.conversion.InputStreamSupplierSource)2 LocalizedError (gov.cms.qpp.conversion.model.error.LocalizedError)2 InputStream (java.io.InputStream)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