### Question:
MapValueValidator implements ServiceAttributeValidator { public boolean validate(Set<String> values) { boolean valid = true; if (!CollectionUtils.isEmpty(values)) { for (String value : values) { if (!valid) { break; } if (value.length() > 0) { Matcher m = pattern.matcher(value); valid = m.matches(); } } } if (valid) { valid = MapDuplicateKeyChecker.checkForNoDuplicateKeyInValue(values); } return valid; }  boolean validate(Set<String> values);  }### Answer:
@Test(dataProvider = "data") public void checkCorrectness(String name, boolean expected) { boolean result = validator.validate(Collections.singleton(name)); assertThat(result).isEqualTo(expected); }
@Test public void checkSetOnlyContainsOneConfigPerApp() { Set<String> set = new HashSet<>(); set.add("[asdf]=ALL"); set.add("[asdf]=NONE"); boolean result = validator.validate(set); assertThat(result).isEqualTo(false); }
@Test public void checkEmptySetPasses() { Set<String> set = new HashSet<>(); boolean result = validator.validate(set); assertThat(result).isEqualTo(true); }