### Question:
NotPredicate extends UnaryPredicate { @Override public boolean evaluate(Resource resource) { return !getPredicate().evaluate(resource); } NotPredicate(Predicate predicate); @Override boolean evaluate(Resource resource); @Override String getOperator();  }### Answer:
@Test public void testApply() { Resource resource = new ResourceImpl(Resource.Type.HostComponent); String propertyId = PropertyHelper.getPropertyId("category1", "foo"); EqualsPredicate predicate = new EqualsPredicate<>(propertyId, "bar"); NotPredicate notPredicate = new NotPredicate(predicate); resource.setProperty(propertyId, "monkey"); Assert.assertTrue(notPredicate.evaluate(resource)); resource.setProperty(propertyId, "bar"); Assert.assertFalse(notPredicate.evaluate(resource)); }