Search in sources :

Example 76 with Detail

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

the class ClinicalDocumentValidatorTest method testNoSectionsOtherChildren.

@Test
void testNoSectionsOtherChildren() {
    Node clinicalDocumentNode = createValidClinicalDocumentNode();
    Node placeholderNode = new Node(TemplateId.PLACEHOLDER);
    clinicalDocumentNode.addChildNode(placeholderNode);
    ClinicalDocumentValidator validator = new ClinicalDocumentValidator();
    Set<Detail> errors = validator.validateSingleNode(clinicalDocumentNode);
    assertWithMessage("error should be about missing section node").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.CLINICAL_DOCUMENT_MISSING_ACI_OR_IA_OR_ECQM_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 77 with Detail

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

the class ClinicalDocumentValidatorTest method testDuplicateQualityMeasureSectionCausesError.

@Test
void testDuplicateQualityMeasureSectionCausesError() {
    Node clinicalDocumentNode = createValidClinicalDocumentNode();
    Node qualityMeasureNode = createQualityMeasureSectionNode(clinicalDocumentNode);
    Node duplicateQualityMeasureNode = createQualityMeasureSectionNode(clinicalDocumentNode);
    clinicalDocumentNode.addChildNodes(qualityMeasureNode, duplicateQualityMeasureNode);
    ClinicalDocumentValidator validator = new ClinicalDocumentValidator();
    Set<Detail> errors = validator.validateSingleNode(clinicalDocumentNode);
    assertWithMessage("Should contain one error").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.CLINICAL_DOCUMENT_CONTAINS_DUPLICATE_IA_SECTIONS);
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 78 with Detail

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

the class ClinicalDocumentValidatorTest method testNpiIsOptional.

@Test
void testNpiIsOptional() {
    Node clinicalDocumentNode = new Node(TemplateId.CLINICAL_DOCUMENT);
    clinicalDocumentNode.putValue("programName", "mips");
    clinicalDocumentNode.putValue("taxpayerIdentificationNumber", "123456789");
    Node aciSectionNode = createAciSectionNode(clinicalDocumentNode);
    clinicalDocumentNode.addChildNode(aciSectionNode);
    ClinicalDocumentValidator validator = new ClinicalDocumentValidator();
    Set<Detail> errors = validator.validateSingleNode(clinicalDocumentNode);
    assertWithMessage("there should be no errors").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 79 with Detail

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

the class ClinicalDocumentValidatorTest method testInvalidProgramName.

@Test
void testInvalidProgramName() {
    Node clinicalDocumentNode = createValidClinicalDocumentNode();
    Node aciSectionNode = createAciSectionNode(clinicalDocumentNode);
    clinicalDocumentNode.addChildNodes(aciSectionNode);
    String invalidProgramName = "Invalid program name";
    clinicalDocumentNode.putValue(ClinicalDocumentDecoder.PROGRAM_NAME, invalidProgramName);
    ClinicalDocumentValidator validator = new ClinicalDocumentValidator();
    Set<Detail> errors = validator.validateSingleNode(clinicalDocumentNode);
    assertWithMessage("Must contain the error").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(ErrorCode.CLINICAL_DOCUMENT_INCORRECT_PROGRAM_NAME.format(invalidProgramName, ClinicalDocumentValidator.VALID_PROGRAM_NAMES));
}
Also used : Node(gov.cms.qpp.conversion.model.Node) Detail(gov.cms.qpp.conversion.model.error.Detail) Test(org.junit.jupiter.api.Test)

Example 80 with Detail

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

the class IaMeasureValidatorTest method testMissingNode.

/**
 * Validate a missing child
 *
 * @throws Exception on test error
 */
@Test
void testMissingNode() throws Exception {
    Node measureNode = new Node(TemplateId.IA_MEASURE);
    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)

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