Search in sources :

Example 86 with Detail

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

the class MeasureDataValidatorTest method duplicateAggregateCountsFails.

@Test
void duplicateAggregateCountsFails() throws Exception {
    Node aggregateCount = new Node(TemplateId.ACI_AGGREGATE_COUNT);
    aggregateCount.putValue("aggregateCount", "100");
    aggregateCount.putValue("aggregateCount", "200", false);
    Node testNode = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    testNode.addChildNodes(aggregateCount);
    MeasureDataValidator validator = new MeasureDataValidator();
    validator.internalValidateSingleNode(testNode);
    Set<Detail> errors = validator.getDetails();
    assertWithMessage("missing error").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.AGGREGATE_COUNT_VALUE_NOT_SINGULAR);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 87 with Detail

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

the class MeasureDataValidatorTest method invalidAggregateCount.

@Test
void invalidAggregateCount() throws Exception {
    Node aggregateCount = new Node(TemplateId.ACI_AGGREGATE_COUNT);
    Node testNode = new Node(TemplateId.MEASURE_DATA_CMS_V2);
    testNode.addChildNode(aggregateCount);
    aggregateCount.putValue("aggregateCount", "error");
    MeasureDataValidator validator = new MeasureDataValidator();
    validator.internalValidateSingleNode(testNode);
    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 88 with Detail

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

the class MeasurePerformedValidatorTest method internalValidateSingleNodeN.

@Test
void internalValidateSingleNodeN() throws Exception {
    Node measurePerformedNode = new Node(TemplateId.MEASURE_PERFORMED);
    measurePerformedNode.putValue("measurePerformed", "N");
    MeasurePerformedValidator validator = new MeasurePerformedValidator();
    Set<Detail> errors = validator.validateSingleNode(measurePerformedNode);
    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 89 with Detail

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

the class MeasurePerformedValidatorTest method internalValidateSingleNodeY.

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

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

the class MeasurePerformedValidatorTest method internalValidateSingleNodeInvalid.

@Test
void internalValidateSingleNodeInvalid() throws Exception {
    Node measurePerformedNode = new Node(TemplateId.MEASURE_PERFORMED);
    measurePerformedNode.putValue("measurePerformed", "wrong value");
    MeasurePerformedValidator validator = new MeasurePerformedValidator();
    Set<Detail> errors = validator.validateSingleNode(measurePerformedNode);
    assertWithMessage("Should result in a single type error").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.IA_MEASURE_INVALID_TYPE);
}
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