Search in sources :

Example 6 with AllErrors

use of gov.cms.qpp.conversion.model.error.AllErrors 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 7 with AllErrors

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

the class ConversionReport method constructErrorHierarchy.

/**
 * Constructs an {@link AllErrors} from all the validation errors.
 *
 * Currently consists of only a single {@link Error}.
 *
 * @param inputIdentifier An identifier for a source of QRDA3 XML.
 * @param details A list of validation errors.
 * @return All the errors.
 */
private AllErrors constructErrorHierarchy(final String inputIdentifier, final List<Detail> details) {
    AllErrors errors = new AllErrors();
    errors.addError(constructErrorSource(inputIdentifier, details));
    return errors;
}
Also used : AllErrors(gov.cms.qpp.conversion.model.error.AllErrors)

Example 8 with AllErrors

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

the class ConversionReportTest method getErrorStream.

@Test
void getErrorStream() {
    Converter converter = new Converter(new PathSource(Paths.get("../qrda-files/valid-QRDA-III-latest.xml")));
    ConversionReport badReport = converter.getReport();
    Error error = new Error();
    error.setMessage("meep");
    AllErrors errors = new AllErrors();
    errors.addError(error);
    badReport.setReportDetails(errors);
    AllErrors echo = JsonHelper.readJson(badReport.getValidationErrorsSource().toInputStream(), AllErrors.class);
    assertThat(echo.toString()).isEqualTo(errors.toString());
}
Also used : AllErrors(gov.cms.qpp.conversion.model.error.AllErrors) Error(gov.cms.qpp.conversion.model.error.Error) Test(org.junit.jupiter.api.Test)

Example 9 with AllErrors

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

the class CpcPlusAcceptanceTest method testCpcPlusFileSuccesses.

@ParameterizedTest
@MethodSource("successData")
void testCpcPlusFileSuccesses(Path entry) {
    AllErrors errors = null;
    Converter converter = new Converter(new PathSource(entry));
    try {
        converter.transform();
    } catch (TransformException failure) {
        errors = failure.getDetails();
    }
    assertThat(errors).isNull();
}
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) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 10 with AllErrors

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

the class QualityMeasureIdRoundTripTest method testMeasureCMS52v5InsensitiveMeasureDataUuid.

@Test
void testMeasureCMS52v5InsensitiveMeasureDataUuid() {
    Converter converter = new Converter(new PathSource(INSENSITIVE_TEXT_FILE));
    List<Detail> details = new ArrayList<>();
    LocalizedError error = ErrorCode.QUALITY_MEASURE_ID_INCORRECT_UUID.format("CMS52v5", "DENOM", "04BF53CE-6993-4EA2-BFE5-66E36172B388");
    try {
        converter.transform();
    } catch (TransformException exception) {
        AllErrors errors = exception.getDetails();
        details.addAll(errors.getErrors().get(0).getDetails());
    }
    assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).doesNotContain(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)

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