@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()); }
@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()); }