Search in sources :

Example 16 with Detail

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

the class IaMeasureValidatorTest method internalValidateSingleNodeN.

@Test
void internalValidateSingleNodeN() throws Exception {
    Node measureNode = new Node(TemplateId.IA_MEASURE);
    Node measurePerformedNode = new Node(TemplateId.MEASURE_PERFORMED, measureNode);
    measureNode.addChildNode(measurePerformedNode);
    measurePerformedNode.putValue("measurePerformed", "N");
    IaMeasureValidator validator = new IaMeasureValidator();
    Collection<Detail> errors = validator.validateSingleNode(measureNode);
    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 17 with Detail

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

the class IaMeasureValidatorTest method internalValidateSingleNodeY.

/**
 * Validate a correct set of Nodes
 *
 * @throws Exception on test error
 */
@Test
void internalValidateSingleNodeY() throws Exception {
    Node measureNode = new Node(TemplateId.IA_MEASURE);
    Node measurePerformedNode = new Node(TemplateId.MEASURE_PERFORMED, measureNode);
    measureNode.addChildNode(measurePerformedNode);
    measurePerformedNode.putValue("measurePerformed", "Y");
    IaMeasureValidator validator = new IaMeasureValidator();
    Collection<Detail> errors = validator.validateSingleNode(measureNode);
    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 18 with Detail

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

the class IaMeasureValidatorTest method testTooManyChildren.

/**
 * Validate a missing child
 *
 * @throws Exception on test error
 */
@Test
void testTooManyChildren() throws Exception {
    Node measureNode = new Node(TemplateId.IA_MEASURE);
    Node measurePerformedNode1 = new Node(TemplateId.MEASURE_PERFORMED, measureNode);
    Node measurePerformedNode2 = new Node(TemplateId.MEASURE_PERFORMED, measureNode);
    measureNode.addChildNode(measurePerformedNode1);
    measurePerformedNode1.putValue("measurePerformed", "Y");
    measureNode.addChildNode(measurePerformedNode2);
    measurePerformedNode1.putValue("measurePerformed", "N");
    IaMeasureValidator validator = new IaMeasureValidator();
    Set<Detail> errors = validator.validateSingleNode(measureNode);
    assertWithMessage("The INCORRECT_CHILDREN_COUNT Error is expected").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.IA_MEASURE_INCORRECT_CHILDREN_COUNT);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 19 with Detail

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

the class IaSectionValidatorTest method testIncorrectChildValidation.

@Test
void testIncorrectChildValidation() {
    Node incorrectAggregateCountNode = new Node(TemplateId.ACI_AGGREGATE_COUNT);
    iaSectionNode.addChildNodes(iaMeasureNode, reportingParamActNode, incorrectAggregateCountNode);
    Set<Detail> errors = validatorIaSection();
    assertWithMessage("Must contain correct children").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.IA_SECTION_WRONG_CHILD);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 20 with Detail

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

the class QrdaValidatorTest method testValidateMultipleNodes.

@Test
public void testValidateMultipleNodes() {
    // set-up
    Node testChildNode1 = new Node(TEST_REQUIRED_TEMPLATE_ID);
    final String testKey = "testKey";
    final String testValue = "testValue";
    testChildNode1.putValue(testKey, testValue);
    Node testChildNode2 = new Node(TEST_REQUIRED_TEMPLATE_ID);
    testChildNode2.putValue(testKey, testValue);
    Node testRootNode = new Node();
    testRootNode.addChildNode(testChildNode1);
    testRootNode.addChildNode(testChildNode2);
    // execute
    List<Detail> details = objectUnderTest.validate(testRootNode);
    // assert
    assertNodeList(nodesPassedIntoValidateSingleNode, 2, TEST_REQUIRED_TEMPLATE_ID, testKey, testValue);
    assertWithMessage("The validation errors is missing the specific number of single node errors").that(details).containsExactly(TEST_VALIDATION_ERROR_FOR_SINGLE_NODE, TEST_VALIDATION_ERROR_FOR_SINGLE_NODE);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

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