### Question:
EqualsPredicate extends ComparisonPredicate<T> { @Override public boolean evaluate(Resource resource) { Object propertyValue = resource.getPropertyValue(getPropertyId()); Object predicateValue = getValue(); return predicateValue == null ? propertyValue == null : propertyValue != null && compareValueTo(propertyValue) == 0; } EqualsPredicate(String propertyId, Comparable<T> value); @Override boolean evaluate(Resource resource); boolean evaluateIgnoreCase(Resource resource); @Override String getOperator(); @Override ComparisonPredicate<T> copy(String propertyId);  }### Answer:
@Test public void testApply() { Resource resource = new ResourceImpl(Resource.Type.HostComponent); String propertyId = PropertyHelper.getPropertyId("category1", "foo"); Predicate predicate = new EqualsPredicate<>(propertyId, "bar"); resource.setProperty(propertyId, "monkey"); Assert.assertFalse(predicate.evaluate(resource)); resource.setProperty(propertyId, "bar"); Assert.assertTrue(predicate.evaluate(resource)); propertyId = PropertyHelper.getPropertyId("category1", "fun"); predicate = new EqualsPredicate<>(propertyId, "bar"); Assert.assertFalse(predicate.evaluate(resource)); }
@Test public void testApplyNumberValues() throws Exception { Resource resource = new ResourceImpl(Resource.Type.HostComponent); String propertyId = PropertyHelper.getPropertyId("propertyId1", "1"); Predicate predicate = new EqualsPredicate<>(propertyId, "1"); resource.setProperty(propertyId, "1"); Assert.assertTrue(predicate.evaluate(resource)); resource.setProperty(propertyId, "2"); Assert.assertFalse(predicate.evaluate(resource)); resource.setProperty(propertyId, "5"); Assert.assertFalse(predicate.evaluate(resource)); }