EndsWithValidationMatcher implements ValidationMatcher { public void validate(String fieldName, String value, List<String> controlParameters, TestContext context) throws ValidationException { String controlValue = controlParameters.get(0); if (!value.endsWith(controlValue)) { throw new ValidationException(this.getClass().getSimpleName() + " failed for field '" + fieldName + "'. Received value is '" + value + "', control value is '" + controlValue + "'."); } }  void validate(String fieldName, String value, List<String> controlParameters, TestContext context);  }
@Test public void testValidateSuccess() { matcher.validate("field", "This is a test", Arrays.asList(""), context); matcher.validate("field", "This is a test", Arrays.asList("t"), context); matcher.validate("field", "This is a test", Arrays.asList(" test"), context); matcher.validate("field", "This is a 0815test", Arrays.asList(" is a 0815test"), context); }