use of gov.cms.qpp.conversion.model.error.LocalizedError in project qpp-conversion-tool by CMSgov.
the class QualityMeasureIdValidatorTest method testPerformanceRateUuidFail.
@Test
void testPerformanceRateUuidFail() {
Node measureReferenceResultsNode = createCorrectMeasureReference(REQUIRES_DENOM_EXCEPTION_GUID).replaceSubPopulationPerformanceRate(REQUIRES_DENOM_EXCEPTION_NUMER_GUID, "fail").build();
Set<Detail> details = objectUnderTest.validateSingleNode(measureReferenceResultsNode);
LocalizedError expectedErrorMessage = ErrorCode.QUALITY_MEASURE_ID_INCORRECT_UUID.format("CMS68v6", PERFORMANCE_RATE_ID, REQUIRES_DENOM_EXCEPTION_NUMER_GUID);
assertWithMessage("Must contain the correct error message.").that(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(expectedErrorMessage);
}
use of gov.cms.qpp.conversion.model.error.LocalizedError in project qpp-conversion-tool by CMSgov.
the class ConverterTest method checkup.
private void checkup(TransformException exception, LocalizedError error) {
AllErrors allErrors = exception.getDetails();
List<Error> errors = allErrors.getErrors();
assertWithMessage("There must only be one error source.").that(errors).hasSize(1);
List<Detail> details = errors.get(0).getDetails();
assertWithMessage("There must be only one validation error.").that(details).hasSize(1);
assertWithMessage("The validation error was incorrect").that(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(error);
}
use of gov.cms.qpp.conversion.model.error.LocalizedError in project qpp-conversion-tool by CMSgov.
the class QualityMeasureIdRoundTripTest method testMeasureCMS68v6PerformanceRateUuid.
@Test
void testMeasureCMS68v6PerformanceRateUuid() {
Converter converter = new Converter(new PathSource(INVALID_PERFORMANCE_UUID_FILE));
List<Detail> details = new ArrayList<>();
try {
converter.transform();
} catch (TransformException exception) {
AllErrors errors = exception.getDetails();
details.addAll(errors.getErrors().get(0).getDetails());
}
String measureId = "CMS68v6";
String correctId = MeasureConfigs.getConfigurationMap().get("40280381-52fc-3a32-0153-3d64af97147b").getSubPopulation().get(0).getNumeratorUuid();
LocalizedError error = ErrorCode.QUALITY_MEASURE_ID_INCORRECT_UUID.format(measureId, PerformanceRateProportionMeasureDecoder.PERFORMANCE_RATE_ID, correctId);
assertThat(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).contains(error);
}
use of gov.cms.qpp.conversion.model.error.LocalizedError in project qpp-conversion-tool by CMSgov.
the class CpcMeasureDataValidator method addSupplementalValidationError.
/**
* Adds a Supplemental Validation Error upon failure
*
* @param node Object being validated
* @param supplementalData Object holding the current code that was validated
* @param measureId current electronic measure identification
*/
private void addSupplementalValidationError(Node node, SupplementalData supplementalData, String measureId) {
LocalizedError error = ErrorCode.CPC_PLUS_MISSING_SUPPLEMENTAL_CODE.format(supplementalData.getType(), supplementalData, supplementalData.getCode(), measureId, node.getValue(MeasureDataDecoder.MEASURE_TYPE));
addValidationError(Detail.forErrorAndNode(error, node));
}
use of gov.cms.qpp.conversion.model.error.LocalizedError in project qpp-conversion-tool by CMSgov.
the class CpcMeasureDataValidator method validateAllSupplementalNodesOfSpecifiedType.
/**
* Validates all of the nodes under one specified Supplemental Type
*
* @param node Parent node of the nodes to be validated
* @param currSupplementalDataTemplateId Template Id of the nodes to be validated
* @param supplementalDataType current data type to be validated
*/
private void validateAllSupplementalNodesOfSpecifiedType(Node node, TemplateId currSupplementalDataTemplateId, SupplementalType supplementalDataType) {
Set<Node> supplementalDataNodes = node.getChildNodes(currSupplementalDataTemplateId).collect(Collectors.toSet());
EnumSet<SupplementalData> codes = EnumSet.copyOf(SupplementalData.getSupplementalDataSetByType(supplementalDataType));
MeasureConfig measureConfig = MeasureConfigHelper.getMeasureConfig(node.getParent());
if (measureConfig != null) {
String electronicMeasureId = measureConfig.getElectronicMeasureId();
for (SupplementalData supplementalData : codes) {
Node validatedSupplementalNode = filterCorrectNode(supplementalDataNodes, supplementalData);
if (validatedSupplementalNode == null) {
addSupplementalValidationError(node, supplementalData, electronicMeasureId);
} else {
LocalizedError error = makeIncorrectCountSizeLocalizedError(node, supplementalData.getCode(), electronicMeasureId);
check(validatedSupplementalNode).childExact(error, 1, TemplateId.ACI_AGGREGATE_COUNT);
}
}
}
}
Aggregations