### Question:
NamesFilter { boolean isNotValidName(String name) { return !isValidName(name); } NamesFilter();   NamesFilter(String filterString);   }### Answer:
@Test public void testIsNotValidNameReturnsFalseWhenFilterIsEmpty() { assertFalse(new NamesFilter(StringUtils.EMPTY).isNotValidName("test1")); assertFalse(new NamesFilter(StringUtils.EMPTY).isNotValidName("test2")); assertFalse(new NamesFilter(StringUtils.EMPTY).isNotValidName("test3")); assertFalse(new NamesFilter(null).isNotValidName("test3")); }
@Test public void testIsNotValidNameReturnsTrueWhenOnlyIncludeWasProvided() { assertTrue(new NamesFilter("+test1,test2,test3").isNotValidName("smthElse1")); assertTrue(new NamesFilter("test1,test2,test3").isNotValidName("smthElse2")); assertTrue(new NamesFilter("+test1,+test2,+test3").isNotValidName("smthElse3")); }
@Test public void testIsNotValidNameReturnsFalseWhenOnlyIncludesWasProvided() { assertFalse(new NamesFilter("+test1,test2,test3").isNotValidName("test1")); assertFalse(new NamesFilter("test1,test2,+test3").isNotValidName("test2")); assertFalse(new NamesFilter("+test1,+test2,+test3").isNotValidName("test3")); }
@Test public void testIsNotValidNameReturnsTrueWhenOnlyExcludeWasProvided() { assertTrue(new NamesFilter("-test1,-test2,-test3").isNotValidName("test1")); assertTrue(new NamesFilter("-test1,-test2,-test3").isNotValidName("test2")); assertTrue(new NamesFilter("-test1,-test2,-test3").isNotValidName("test3")); }
@Test public void testIsNotValidNameReturnsFalseWhenOnlyExcludeWasProvided() { assertFalse(new NamesFilter("-test1,-test2,-test3").isNotValidName("smthElse1")); assertFalse(new NamesFilter("-test1,-test2,-test3").isNotValidName("smthElse2")); assertFalse(new NamesFilter("-test1,-test2,-test3").isNotValidName("smthElse3")); }
@Test public void testIsNotValidNameReturnsTrueWhenItemWasIncludedAndExcluded() { assertTrue(new NamesFilter("-test1,test1").isNotValidName("test1")); }
@Test public void testIsNotValidNameWhenBothFiltersAreApplied() { assertTrue(new NamesFilter("-test1,+test2,test3,-test4").isNotValidName("test1")); assertTrue(new NamesFilter("-test1,test2,+test3,-test4").isNotValidName("test4")); assertTrue(new NamesFilter("-test1,+test2,+test3,-test4").isNotValidName("test5")); assertFalse(new NamesFilter("-test1,test2,test3,-test4").isNotValidName("test2")); assertFalse(new NamesFilter("-test1,test2,test3,-test4").isNotValidName("test3")); }