Search in sources :

Example 91 with Detail

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

the class QrdaValidatorTest method testNoNodes.

@Test
public void testNoNodes() {
    // set-up
    Node testRootNode = new Node();
    // execute
    List<Detail> details = objectUnderTest.validate(testRootNode);
    // assert
    assertNodeList(nodesPassedIntoValidateSingleNode, 0, null, null, null);
    assertWithMessage("The validation errors (incorrectly) has a single node error and an error from the  and optional templateId").that(details).doesNotContain(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)

Example 92 with Detail

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

the class QrdaValidatorTest method testOptionalValidation.

@Test
public void testOptionalValidation() {
    // set-up
    Node testRootNode = new Node();
    testRootNode.setType(TEST_OPTIONAL_TEMPLATE_ID);
    final String testKey = "testKey";
    final String testValue = "testValue";
    testRootNode.putValue(testKey, testValue);
    // execute
    List<Detail> details = objectUnderTest.validate(testRootNode);
    // assert
    assertNodeList(nodesPassedIntoValidateSingleNode, 0, null, null, null);
    assertWithMessage("The validation errors (incorrectly) has a single node error and an error from the  and optional templateId").that(details).doesNotContain(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)

Example 93 with Detail

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

the class QrdaValidatorTest method testValidateSingleNode.

@Test
public void testValidateSingleNode() {
    // set-up
    Node testRootNode = new Node(TEST_REQUIRED_TEMPLATE_ID);
    final String testKey = "testKey";
    final String testValue = "testValue";
    testRootNode.putValue(testKey, testValue);
    // execute
    List<Detail> details = objectUnderTest.validate(testRootNode);
    // assert
    assertNodeList(nodesPassedIntoValidateSingleNode, 1, TEST_REQUIRED_TEMPLATE_ID, testKey, testValue);
    assertWithMessage("The validation errors is missing items from the expected templateId").that(details).contains(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)

Example 94 with Detail

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

the class QualityMeasureIdValidatorTest method testTooManyCriteriaExists.

@Test
void testTooManyCriteriaExists() {
    Node measureReferenceResultsNode = createCorrectMeasureReference(MULTIPLE_POPULATION_DENOM_EXCEPTION_GUID).addSubPopulationMeasureDataWithCounts(SubPopulationLabel.NUMER.name(), MULTIPLE_POPULATION_DENOM_EXCEPTION_NUMER1_GUID, ONE_HUNDRED).build();
    Set<Detail> details = objectUnderTest.validateSingleNode(measureReferenceResultsNode);
    LocalizedError expectedErrorMessage = ErrorCode.POPULATION_CRITERIA_COUNT_INCORRECT.format("CMS52v5", 3, SubPopulationLabel.NUMER.name(), 4);
    assertWithMessage("Incorrect validation error.").that(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(expectedErrorMessage);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) LocalizedError(gov.cms.qpp.conversion.model.error.LocalizedError) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 95 with Detail

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

the class QualityMeasureIdValidatorTest method validateMissingMeasureId.

@Test
void validateMissingMeasureId() {
    Node measureReferenceResultsNode = createMeasureReferenceResultsNode(false, true);
    Set<Detail> details = objectUnderTest.validateSingleNode(measureReferenceResultsNode);
    assertWithMessage("Incorrect validation error.").that(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.MEASURE_GUID_MISSING);
}
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