Search in sources :

Example 11 with Converter

use of gov.cms.qpp.conversion.Converter 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 Converter

use of gov.cms.qpp.conversion.Converter 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 Converter

use of gov.cms.qpp.conversion.Converter 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 Converter

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

the class QrdaServiceImplTest method mockConverter.

@BeforeEach
void mockConverter() {
    Converter success = successConverter();
    when(objectUnderTest.initConverter(MOCK_SUCCESS_QRDA_SOURCE)).thenReturn(success);
    Converter error = errorConverter();
    when(objectUnderTest.initConverter(MOCK_ERROR_QRDA_SOURCE)).thenReturn(error);
}
Also used : Converter(gov.cms.qpp.conversion.Converter) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 15 with Converter

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

the class QrdaServiceImplTest method successConverter.

private Converter successConverter() {
    Converter mockConverter = mock(Converter.class);
    JsonWrapper qpp = new JsonWrapper();
    qpp.putString(KEY, MOCK_SUCCESS_QPP_STRING);
    ConversionReport report = mock(ConversionReport.class);
    when(report.getEncoded()).thenReturn(qpp);
    when(mockConverter.getReport()).thenReturn(report);
    return mockConverter;
}
Also used : JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) Converter(gov.cms.qpp.conversion.Converter) ConversionReport(gov.cms.qpp.conversion.ConversionReport)

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