### Question:
CodestartFileStrategy implements Predicate<String> { @Override public boolean test(String t) { if (t == null) { return false; } if (filter.startsWith("*") && filter.length() > 1) { if (t.endsWith(filter.substring(1))) { return true; } } if (filter.endsWith("*") && filter.length() > 1) { if (t.startsWith(filter.substring(0, filter.length() - 1))) { return true; } } return filter.equals(t); } CodestartFileStrategy(String filter, CodestartFileStrategyHandler handler); String getFilter(); @Override boolean test(String t); CodestartFileStrategyHandler getHandler(); @Override String toString();  }### Answer:
@Test void testFilterStart() { final CodestartFileStrategy strategy = new CodestartFileStrategy("*.txt", mock(CodestartFileStrategyHandler.class)); assertThat(strategy.test("myfile.txt")).isTrue(); assertThat(strategy.test(null)).isFalse(); assertThat(strategy.test("foo/bar/myfile.txt")).isTrue(); assertThat(strategy.test(".txt")).isTrue(); assertThat(strategy.test("foo/bar/myfile.zip")).isFalse(); assertThat(strategy.test("")).isFalse(); }
@Test void testFilterEnd() { final CodestartFileStrategy strategy = new CodestartFileStrategy("/foo/bar/*", mock(CodestartFileStrategyHandler.class)); assertThat(strategy.test("/foo/bar/myfile.txt")).isTrue(); assertThat(strategy.test("/foo/bar/baz/anoter_file")).isTrue(); assertThat(strategy.test(null)).isFalse(); assertThat(strategy.test("foo/bar/myfile.txt")).isFalse(); assertThat(strategy.test("something")).isFalse(); assertThat(strategy.test("")).isFalse(); }
@Test void testFilter() { final CodestartFileStrategy strategy = new CodestartFileStrategy("/foo/bar/myfile.txt", mock(CodestartFileStrategyHandler.class)); assertThat(strategy.test("/foo/bar/myfile.txt")).isTrue(); assertThat(strategy.test("/foo/bar/myfile.tx")).isFalse(); assertThat(strategy.test(null)).isFalse(); assertThat(strategy.test("foo/bar/myfile.txt")).isFalse(); assertThat(strategy.test("something")).isFalse(); assertThat(strategy.test("")).isFalse(); }