Skip to content

Commit

Permalink
Merge pull request #249 from MeasureAuthoringTool/feature/mat-7437-im…
Browse files Browse the repository at this point in the history
…provement-notation-constraints

MAT-7437: Allow for empty Improvement Notation since it is optional.
  • Loading branch information
jkotanchik-SB authored Oct 22, 2024
2 parents 06a0080 + 4eb082e commit 38b54c1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>gov.cms.madie</groupId>
<artifactId>madie-java-models</artifactId>
<version>0.6.67-SNAPSHOT</version>
<version>0.6.68-SNAPSHOT</version>
<name>madie-java-models</name>
<description>Java based models for MADiE microservices</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ public class ImprovementNotationValidator

@Override
public boolean isValid(QdmMeasure measure, ConstraintValidatorContext context) {
if (StringUtils.isEmpty(measure.getImprovementNotation())) {
return StringUtils.isEmpty(measure.getImprovementNotationDescription());
}
if (StringUtils.equalsIgnoreCase(
measure.getImprovementNotation(), "Increased score indicates improvement")
|| StringUtils.equalsIgnoreCase(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ void testImprovementNotationDecrease() {
assertTrue(validator.isValid(measure, validatorContext));
}

@Test
void testImprovementNotationWithDescription() {
measure.setImprovementNotation("Decreased score indicates improvement");
measure.setImprovementNotationDescription("Something useful");
assertTrue(validator.isValid(measure, validatorContext));
}

@Test
void testImprovementNotationOtherHasDescription() {
measure.setImprovementNotation("Other");
Expand All @@ -59,4 +66,15 @@ void testInvalidImprovementNotation() {
measure.setImprovementNotation("Invalid");
assertFalse(validator.isValid(measure, validatorContext));
}

@Test
void testImprovementNotationDescriptionOnly() {
measure.setImprovementNotationDescription("Nonsense description");
assertFalse(validator.isValid(measure, validatorContext));
}

@Test
void testEmptyImprovementNotation() {
assertTrue(validator.isValid(measure, validatorContext));
}
}

0 comments on commit 38b54c1

Please sign in to comment.