### Question:
FilterModeValueValidator implements ServiceAttributeValidator { public boolean validate(Set<String> values) { boolean valid = true; boolean globalFound = false; if (CollectionUtils.isNotEmpty(values)) { for (String val : values) { if (!valid) { break; } String trimmed = val.trim(); Matcher matcher = pattern.matcher(trimmed); valid = matcher.matches(); Matcher globalMatcher = globalPattern.matcher(trimmed); boolean globalMatch = globalMatcher.matches(); if (globalFound && globalMatch && valid) { valid = false; } else if (globalMatch && valid) { globalFound = true; } } } else { valid = false; } 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 checkSetOnlyContainsOneGlobalConfig() { Set<String> set = new HashSet<>(); set.add("=ALL"); set.add("=NONE"); boolean result = validator.validate(set); assertThat(result).isEqualTo(false); }
@Test public void checkEmptySetFails() { Set<String> set = new HashSet<>(); boolean result = validator.validate(set); assertThat(result).isEqualTo(false); }