### Question:
FilteringDecorator implements AccessVisitor { @Override public void newNode(final ElementName clazz) { if (this.filter.test(clazz)) { this.child.newNode(clazz); } } FilteringDecorator(final AccessVisitor child, final Predicate<ElementName> filter); @Override void apply(final AccessPoint source, final AccessPoint dest, final AccessType type); @Override void newNode(final ElementName clazz); @Override void newEntryPoint(ElementName clazz); @Override void newAccessPoint(AccessPoint ap);  }### Answer:
@Test public void shouldNotForwardNewNodeWhenFilterDoesNotMatch() { when(this.filter.test(this.fooElement)).thenReturn(false); this.testee.newNode(this.fooElement); verify(this.child, never()).newNode(this.fooElement); }
@Test public void shouldForwardNewNodeWhenFilterMatches() { when(this.filter.test(this.fooElement)).thenReturn(true); this.testee.newNode(this.fooElement); verify(this.child).newNode(this.fooElement); }