Search in sources :

Example 51 with Detail

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

the class AciNumeratorDenominatorValidatorTest method testNoChildNodes.

@Test
void testNoChildNodes() {
    Node aciSectionNode = new Node(TemplateId.ACI_SECTION);
    aciSectionNode.putValue("category", "aci");
    Node aciNumeratorDenominatorNode = new Node(TemplateId.ACI_NUMERATOR_DENOMINATOR, aciSectionNode);
    aciNumeratorDenominatorNode.putValue("measureId", "ACI_EP_1");
    aciSectionNode.addChildNode(aciNumeratorDenominatorNode);
    AciNumeratorDenominatorValidator measureval = new AciNumeratorDenominatorValidator();
    Set<Detail> errors = measureval.validateSingleNode(aciNumeratorDenominatorNode);
    assertWithMessage("error should be about no child nodes").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.ACI_NUMERATOR_DENOMINATOR_MISSING_CHILDREN);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 52 with Detail

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

the class AciNumeratorDenominatorValidatorTest method testNumerateDenominatorMissingMeasureId.

@Test
void testNumerateDenominatorMissingMeasureId() {
    Node aciSectionNode = new Node(TemplateId.ACI_SECTION);
    Node aciNumeratorDenominatorNode = new Node(TemplateId.ACI_NUMERATOR_DENOMINATOR, aciSectionNode);
    Node aciDenominatorNode = new Node(TemplateId.ACI_DENOMINATOR, aciNumeratorDenominatorNode);
    Node aciNumeratorNode = new Node(TemplateId.ACI_NUMERATOR, aciNumeratorDenominatorNode);
    aciNumeratorDenominatorNode.addChildNode(aciNumeratorNode);
    aciNumeratorDenominatorNode.addChildNode(aciDenominatorNode);
    aciSectionNode.putValue("category", "aci");
    aciSectionNode.addChildNode(aciNumeratorDenominatorNode);
    AciNumeratorDenominatorValidator measureVal = new AciNumeratorDenominatorValidator();
    Set<Detail> errors = measureVal.validateSingleNode(aciNumeratorDenominatorNode);
    assertWithMessage("error should be about missing numerator denominator measure name").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.ACI_NUMERATOR_DENOMINATOR_MISSING_MEASURE_ID);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 53 with Detail

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

the class AciNumeratorDenominatorValidatorTest method testMeasurePresent.

@Test
void testMeasurePresent() {
    Node clinicalDocumentNode = new Node(TemplateId.CLINICAL_DOCUMENT);
    clinicalDocumentNode.putValue("programName", "mips");
    clinicalDocumentNode.putValue("taxpayerIdentificationNumber", "123456789");
    clinicalDocumentNode.putValue("nationalProviderIdentifier", "2567891421");
    clinicalDocumentNode.putValue("performanceStart", "20170101");
    clinicalDocumentNode.putValue("performanceEnd", "20171231");
    Node aciSectionNode = new Node(TemplateId.ACI_SECTION, clinicalDocumentNode);
    aciSectionNode.putValue("category", "aci");
    clinicalDocumentNode.addChildNode(aciSectionNode);
    Node aciNumeratorDenominatorNode = new Node(TemplateId.ACI_NUMERATOR_DENOMINATOR, aciSectionNode);
    aciNumeratorDenominatorNode.putValue("measureId", "ACI_EP_1");
    aciSectionNode.addChildNode(aciNumeratorDenominatorNode);
    Node aciDenominatorNode = new Node(TemplateId.ACI_DENOMINATOR, aciNumeratorDenominatorNode);
    Node aciNumeratorNode = new Node(TemplateId.ACI_NUMERATOR, aciNumeratorDenominatorNode);
    aciNumeratorDenominatorNode.addChildNode(aciNumeratorNode);
    aciNumeratorDenominatorNode.addChildNode(aciDenominatorNode);
    AciNumeratorDenominatorValidator measureVal = new AciNumeratorDenominatorValidator();
    Set<Detail> errors = measureVal.validateSingleNode(aciNumeratorDenominatorNode);
    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 54 with Detail

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

the class AciNumeratorDenominatorValidatorTest method testNoDenominator.

@Test
void testNoDenominator() {
    Node aciSectionNode = new Node(TemplateId.ACI_SECTION);
    aciSectionNode.putValue("category", "aci");
    Node aciNumeratorDenominatorNode = new Node(TemplateId.ACI_NUMERATOR_DENOMINATOR, aciSectionNode);
    aciNumeratorDenominatorNode.putValue("measureId", "ACI_EP_1");
    aciSectionNode.addChildNode(aciNumeratorDenominatorNode);
    Node aciDenominatorPlaceholder = new Node(TemplateId.PLACEHOLDER, aciNumeratorDenominatorNode);
    Node aciNumeratorNode = new Node(TemplateId.ACI_NUMERATOR, aciNumeratorDenominatorNode);
    aciNumeratorDenominatorNode.addChildNode(aciDenominatorPlaceholder);
    aciNumeratorDenominatorNode.addChildNode(aciNumeratorNode);
    AciNumeratorDenominatorValidator measureval = new AciNumeratorDenominatorValidator();
    Set<Detail> errors = measureval.validateSingleNode(aciNumeratorDenominatorNode);
    assertWithMessage("error should be about missing Denominator node").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.ACI_NUMERATOR_DENOMINATOR_VALIDATOR_EXACTLY_ONE_DENOMINATOR_CHILD_NODE);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 55 with Detail

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

the class AciNumeratorDenominatorValidatorTest method testTooManyNumerators.

@Test
void testTooManyNumerators() {
    Node aciSectionNode = new Node(TemplateId.ACI_SECTION);
    aciSectionNode.putValue("category", "aci");
    Node aciNumeratorDenominatorNode = new Node(TemplateId.ACI_NUMERATOR_DENOMINATOR, aciSectionNode);
    aciNumeratorDenominatorNode.putValue("measureId", "ACI_EP_1");
    aciSectionNode.addChildNode(aciNumeratorDenominatorNode);
    Node aciDenominatorNode = new Node(TemplateId.ACI_DENOMINATOR, aciNumeratorDenominatorNode);
    Node aciNumeratorNode = new Node(TemplateId.ACI_NUMERATOR, aciNumeratorDenominatorNode);
    Node aciNumeratorNode2 = new Node(TemplateId.ACI_NUMERATOR, aciNumeratorDenominatorNode);
    aciNumeratorDenominatorNode.addChildNode(aciDenominatorNode);
    aciNumeratorDenominatorNode.addChildNode(aciNumeratorNode);
    aciNumeratorDenominatorNode.addChildNode(aciNumeratorNode2);
    AciNumeratorDenominatorValidator measureval = new AciNumeratorDenominatorValidator();
    Set<Detail> errors = measureval.validateSingleNode(aciNumeratorDenominatorNode);
    assertWithMessage("error should be about too many Numerator nodes").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.ACI_NUMERATOR_DENOMINATOR_VALIDATOR_EXACTLY_ONE_NUMERATOR_CHILD_NODE);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) 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