PropertyPredicate implements Predicate<NodeState>, com.google.common.base.Predicate<NodeState> { @Override public boolean test(NodeState node) { PropertyState property = node.getProperty(name); return property != null && propertyPredicate.test(property); } PropertyPredicate(
            @NotNull String name, @NotNull Predicate<PropertyState> propertyPredicate); @Override boolean test(NodeState node); @Deprecated @Override boolean apply(NodeState node);  }
@Test public void propertyMatch() { String name = "foo"; final String value = "bar"; PropertyPredicate p = new PropertyPredicate(name, new Predicate<PropertyState>() { @Override public boolean test(PropertyState property) { return value.equals(property.getValue(STRING)); } }); assertTrue(p.test(createWithProperty(name, value))); }
@Test public void propertyMiss() { String name = "foo"; final String value = "bar"; PropertyPredicate p = new PropertyPredicate(name, new Predicate<PropertyState>() { @Override public boolean test(PropertyState property) { return "baz".equals(property.getValue(STRING)); } }); assertFalse(p.test(createWithProperty(name, value))); }
@Test public void nonExistingProperty() { String name = "foo"; final String value = "bar"; PropertyPredicate p = new PropertyPredicate("any", new Predicate<PropertyState>() { @Override public boolean test(PropertyState property) { return value.equals(property.getValue(STRING)); } }); assertFalse(p.test(createWithProperty(name, value))); }