GlobbingPathFilter implements EventFilter { @Override public boolean includeAdd(PropertyState after) { return includeItem(after.getName()); } private  GlobbingPathFilter(@NotNull List<String> pattern, Map<String, Pattern> patternMap);  GlobbingPathFilter(@NotNull String pattern, Map<String, Pattern> patternMap);  GlobbingPathFilter(@NotNull String pattern); @Override boolean includeAdd(PropertyState after); @Override boolean includeChange(PropertyState before, PropertyState after); @Override boolean includeDelete(PropertyState before); @Override boolean includeAdd(String name, NodeState after); @Override boolean includeDelete(String name, NodeState before); @Override boolean includeMove(String sourcePath, String name, NodeState moved); @Override boolean includeReorder(String destName, String name, NodeState reordered); @Override EventFilter create(String name, NodeState before, NodeState after); @Override String toString(); static final String STAR; static final String STAR_STAR; }
@Test public void singleMatchesSingle() { EventFilter filter = new GlobbingPathFilter("q"); assertTrue(filter.includeAdd("q", tree.getNodeState())); }
@Test public void starMatchesSingle() { EventFilter filter = new GlobbingPathFilter(STAR); assertTrue(filter.includeAdd("q", tree.getNodeState())); }
@Test public void wildcardMatches() { EventFilter filter = new GlobbingPathFilter("*.*"); assertFalse(filter.includeAdd("a", tree.getNodeState())); assertTrue(filter.includeAdd(".b", tree.getNodeState())); assertTrue(filter.includeAdd("a.b", tree.getNodeState())); assertTrue(filter.includeAdd("a.", tree.getNodeState())); filter = new GlobbingPathFilter("*.html"); assertFalse(filter.includeAdd("a.b", tree.getNodeState())); assertFalse(filter.includeAdd("html", tree.getNodeState())); assertTrue(filter.includeAdd(".html", tree.getNodeState())); assertTrue(filter.includeAdd("a.html", tree.getNodeState())); filter = new GlobbingPathFilter("*foo*.html"); assertFalse(filter.includeAdd("a.b", tree.getNodeState())); assertFalse(filter.includeAdd("a.html", tree.getNodeState())); assertTrue(filter.includeAdd("foo.html", tree.getNodeState())); assertTrue(filter.includeAdd("my-foo-bar.html", tree.getNodeState())); }