LikeConstraint implements Constraint { public boolean matchesHostName(String hostname) { return lhs.equalsIgnoreCase(HOSTNAME) && hostname != null && pattern.matcher(hostname).matches(); } LikeConstraint(String lhs, String rhsRegex); boolean isConstraintOnHostName(); boolean matchesHostName(String hostname); boolean matchesSlaveAttributes(Collection<Attribute> attributes); @Override Type getType(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testMatchesHostName() throws Exception { assertTrue(constraintOne.matchesHostName("host-1.example.com")); assertTrue(constraintTwo.matchesHostName("host-1.example.com")); }