Search in sources :

Example 16 with Converter

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

the class ClinicalDocumentValidatorTest method testClinicalDocumentValidationParsesMultipleErrors.

@Test
void testClinicalDocumentValidationParsesMultipleErrors() {
    // setup
    Path path = Paths.get("src/test/resources/negative/angerClinicalDocumentValidations.xml");
    // execute
    Context context = new Context();
    context.setDoDefaults(true);
    Converter converter = new Converter(new PathSource(path), context);
    AllErrors allErrors = new AllErrors();
    try {
        converter.transform();
    } catch (TransformException exception) {
        allErrors = exception.getDetails();
    }
    List<Detail> errors = getErrors(allErrors);
    assertWithMessage("Must have 4 errors").that(errors).hasSize(4);
    assertWithMessage("Must contain the correct errors").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsAllOf(ErrorCode.CLINICAL_DOCUMENT_MISSING_PROGRAM_NAME, ErrorCode.REPORTING_PARAMETERS_MUST_CONTAIN_SINGLE_PERFORMANCE_START);
}
Also used : Path(java.nio.file.Path) Context(gov.cms.qpp.conversion.Context) 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 17 with Converter

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

the class QualityMeasureScopedTest method scopedConversion.

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

Example 18 with Converter

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

the class QrdaServiceImplTest method errorConverter.

private Converter errorConverter() {
    Converter mockConverter = mock(Converter.class);
    AllErrors allErrors = new AllErrors();
    allErrors.addError(new Error(MOCK_ERROR_SOURCE_IDENTIFIER, null));
    ConversionReport report = mock(ConversionReport.class);
    when(report.getReportDetails()).thenReturn(allErrors);
    TransformException transformException = new TransformException("mock problem", new NullPointerException(), report);
    when(mockConverter.transform()).thenThrow(transformException);
    return mockConverter;
}
Also used : AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) TransformException(gov.cms.qpp.conversion.model.error.TransformException) Converter(gov.cms.qpp.conversion.Converter) Error(gov.cms.qpp.conversion.model.error.Error) ConversionReport(gov.cms.qpp.conversion.ConversionReport)

Example 19 with Converter

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

the class ValidationServiceImplTest method setup.

@BeforeAll
static void setup() throws IOException {
    service = new ValidationServiceImpl(null);
    pathToSubmissionError = Paths.get("src/test/resources/submissionErrorFixture.json");
    pathToSubmissionDuplicateEntryError = Paths.get("src/test/resources/submissionDuplicateEntryErrorFixture.json");
    Path toConvert = Paths.get("../qrda-files/valid-QRDA-III-latest.xml");
    qppWrapper = new JsonWrapper(new Converter(new PathSource(toConvert)).transform(), false);
    prepAllErrors();
}
Also used : Path(java.nio.file.Path) JsonWrapper(gov.cms.qpp.conversion.encode.JsonWrapper) PathSource(gov.cms.qpp.conversion.PathSource) Converter(gov.cms.qpp.conversion.Converter) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 20 with Converter

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

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