Search in sources :

Example 31 with Detail

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

the class QualityMeasureSectionValidatorTest method testTooManyReportingParams.

@Test
void testTooManyReportingParams() {
    Node secondReportingParameterNode = new Node(TemplateId.REPORTING_PARAMETERS_ACT);
    qualityMeasureSectionNode.addChildNodes(reportingParameterNode, secondReportingParameterNode);
    Set<Detail> errors = validateQualityMeasureSection();
    assertWithMessage("Must contain correct error").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.QUALITY_MEASURE_SECTION_REQUIRED_REPORTING_PARAM_REQUIREMENT);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 32 with Detail

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

the class AggregateCountValidatorTest method testValueTypeFailure.

@Test
void testValueTypeFailure() {
    Node aggregateCountNode = new Node(TemplateId.ACI_AGGREGATE_COUNT);
    aggregateCountNode.putValue(AggregateCountDecoder.AGGREGATE_COUNT, "meep");
    AggregateCountValidator validator = new AggregateCountValidator();
    validator.internalValidateSingleNode(aggregateCountNode);
    Set<Detail> errors = validator.getDetails();
    assertWithMessage("Should result in a type error").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.AGGREGATE_COUNT_VALUE_NOT_INTEGER);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 33 with Detail

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

the class CheckerTest method testCheckerHasInvalidMeasure.

@Test
void testCheckerHasInvalidMeasure() {
    Set<Detail> errors = new LinkedHashSet<>();
    Node root = new Node();
    Node measure = new Node(TemplateId.CLINICAL_DOCUMENT, root);
    measure.putValue("NotAMeasure", "0");
    root.addChildNode(measure);
    Checker.check(root, errors).hasMeasures(ERROR_MESSAGE, "MeasureId");
    assertWithMessage("Checker should return one validation error").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ERROR_MESSAGE);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 34 with Detail

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

the class ClinicalDocumentValidatorTest method testClinicalDocumentPresent.

@Test
void testClinicalDocumentPresent() {
    Node clinicalDocumentNode = createValidClinicalDocumentNode();
    Node aciSectionNode = createAciSectionNode(clinicalDocumentNode);
    clinicalDocumentNode.addChildNode(aciSectionNode);
    ClinicalDocumentValidator validator = new ClinicalDocumentValidator();
    Set<Detail> errors = validator.validateSingleNode(clinicalDocumentNode);
    assertWithMessage("no errors should be present").that(errors).isEmpty();
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 35 with Detail

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

Aggregations

Detail (gov.cms.qpp.conversion.model.error.Detail)123 Test (org.junit.jupiter.api.Test)108 Node (gov.cms.qpp.conversion.model.Node)105 LocalizedError (gov.cms.qpp.conversion.model.error.LocalizedError)16 Converter (gov.cms.qpp.conversion.Converter)9 AllErrors (gov.cms.qpp.conversion.model.error.AllErrors)9 TransformException (gov.cms.qpp.conversion.model.error.TransformException)9 PathSource (gov.cms.qpp.conversion.PathSource)8 ArrayList (java.util.ArrayList)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 Context (gov.cms.qpp.conversion.Context)4 Test (org.junit.Test)4 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)4 QrdaDecoderEngine (gov.cms.qpp.conversion.decode.QrdaDecoderEngine)3 FormattedErrorCode (gov.cms.qpp.conversion.model.error.FormattedErrorCode)3 Path (java.nio.file.Path)2 LinkedHashSet (java.util.LinkedHashSet)2 InputStreamSupplierSource (gov.cms.qpp.conversion.InputStreamSupplierSource)1 JsonWrapper (gov.cms.qpp.conversion.encode.JsonWrapper)1 TemplateId (gov.cms.qpp.conversion.model.TemplateId)1