Skip to content

Commit

Permalink
MAT-7437: Prevent description on empty notation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotanchik-SB committed Oct 22, 2024
1 parent 0d61efa commit 4eb082e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class ImprovementNotationValidator
@Override
public boolean isValid(QdmMeasure measure, ConstraintValidatorContext context) {
if (StringUtils.isEmpty(measure.getImprovementNotation())) {
return true;
return StringUtils.isEmpty(measure.getImprovementNotationDescription());
}
if (StringUtils.equalsIgnoreCase(
measure.getImprovementNotation(), "Increased score indicates improvement")
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 @@ -60,6 +67,12 @@ void testInvalidImprovementNotation() {
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));
Expand Down

0 comments on commit 4eb082e

Please sign in to comment.