AndFilter implements NodeFilter { @Override public boolean isAccepted(Node node) { return baseFilters.stream().allMatch(filter -> filter.isAccepted(node)); } AndFilter(NodeFilter... baseFilters); @Override boolean isAccepted(Node node);  }
@Test public void testIsAccepted() throws Exception { NodeFilter f1 = new AndFilter(new TrueFilter(), new TrueFilter()); assertThat(f1.isAccepted(new Node("x")), is(true)); NodeFilter f2 = new AndFilter(new TrueFilter(), new NotFilter(new TrueFilter())); assertThat(f2.isAccepted(new Node("x")), is(false)); }