@Test
public void testApply() throws Exception {

  Resource resource = new ResourceImpl(Resource.Type.HostComponent);
  String propertyId = PropertyHelper.getPropertyId("category1", "ip");
  Predicate predicate = new FilterPredicate(propertyId, IP_ADDRESS_PATTERN);
  resource.setProperty(propertyId, "monkey");
  Assert.assertFalse(predicate.evaluate(resource));
  resource.setProperty(propertyId, "10.0.0.1");
  Assert.assertTrue(predicate.evaluate(resource));
  resource.setProperty(propertyId, "127.0.0.1");
  Assert.assertTrue(predicate.evaluate(resource));
  resource.setProperty(propertyId, "0.0.0.0");
  Assert.assertTrue(predicate.evaluate(resource));
  propertyId = PropertyHelper.getPropertyId("category1", "fun");
  predicate = new FilterPredicate(propertyId, IP_ADDRESS_PATTERN);
  Assert.assertFalse(predicate.evaluate(resource));
}