use of gov.cms.qpp.conversion.model.error.FormattedErrorCode in project qpp-conversion-tool by CMSgov.
the class FormattedErrorCodeTest method testEqualsDifferentErrorCode.
@Test
void testEqualsDifferentErrorCode() {
FormattedErrorCode o1 = new FormattedErrorCode(ErrorCode.UNEXPECTED_ERROR, "Some Message");
FormattedErrorCode o2 = new FormattedErrorCode(ErrorCode.ACI_NUMERATOR_DENOMINATOR_MISSING_MEASURE_ID, "Some Message");
Truth.assertThat(o1).isNotEqualTo(o2);
}
use of gov.cms.qpp.conversion.model.error.FormattedErrorCode in project qpp-conversion-tool by CMSgov.
the class CheckerTest method testCheckerHasMeasuresShortCut.
@Test
void testCheckerHasMeasuresShortCut() {
Set<Detail> errors = new LinkedHashSet<>();
Detail err = new Detail();
err.setMessage("test");
errors.add(err);
Node root = new Node();
Checker.check(root, errors).hasMeasures(ERROR_MESSAGE, "MeasureId");
assertWithMessage("Checker should return one validation error").that(errors).comparingElementsUsing(DetailsErrorEquals.INSTANCE).containsExactly(new FormattedErrorCode(null, "test"));
}
use of gov.cms.qpp.conversion.model.error.FormattedErrorCode in project qpp-conversion-tool by CMSgov.
the class QualityMeasureSectionValidatorTest method duplicateEcqMeasure.
@Test
void duplicateEcqMeasure() {
List<Detail> errorDetails = manipulatorHandler.executeScenario(MEASURE_REFERENCE_RESULTS_CMS_V2.name(), "measureId", false);
assertThat(errorDetails).comparingElementsUsing(DetailsErrorEquals.INSTANCE).contains(new FormattedErrorCode(ErrorCode.MEASURE_GUID_MISSING, ErrorCode.MEASURE_GUID_MISSING.getMessage()));
}
use of gov.cms.qpp.conversion.model.error.FormattedErrorCode in project qpp-conversion-tool by CMSgov.
the class ConverterTest method testValidationErrors.
@Test
@PrepareForTest({ Converter.class, QrdaValidator.class })
public void testValidationErrors() throws Exception {
Context context = new Context();
context.setDoDefaults(true);
TestHelper.mockDecoder(context, JennyDecoder.class, new ComponentKey(TemplateId.DEFAULT, Program.ALL));
QrdaValidator mockQrdaValidator = TestHelper.mockValidator(context, TestDefaultValidator.class, new ComponentKey(TemplateId.DEFAULT, Program.ALL), true);
PowerMockito.whenNew(QrdaValidator.class).withAnyArguments().thenReturn(mockQrdaValidator);
Path path = Paths.get("src/test/resources/converter/errantDefaultedNode.xml");
Converter converter = new Converter(new PathSource(path), context);
try {
converter.transform();
fail("The converter should not create valid QPP JSON");
} catch (TransformException exception) {
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("The expected validation error was missing").that(details).comparingElementsUsing(DetailsErrorEquals.INSTANCE).contains(new FormattedErrorCode(ErrorCode.UNEXPECTED_ERROR, "Test validation error for Jenny"));
}
}
Aggregations