コード例 #1
0
 @Test
 public void should_store_comparison_type() {
   validator = new TestValidator();
   validator.ruleFor(Person.class, "forename").notEqual(Person.class, "surname");
   NotEqualValidator notEqualValidator =
       (NotEqualValidator)
           validator.createDescriptor().getValidatorsForMember("forename").iterator().next();
   assertEquals(Comparison.notEqual, notEqualValidator.getComparison());
 }
コード例 #2
0
 @Test
 public void should_store_property_to_compare() {
   validator = new TestValidator();
   validator.ruleFor(Person.class, "forename").notEqual(Person.class, "surname");
   NotEqualValidator notEqualValidator =
       (NotEqualValidator)
           validator.createDescriptor().getValidatorsForMember("forename").iterator().next();
   assertEquals("surname", notEqualValidator.getMemberToCompare().getName());
 }