### Question:
PastValidatorForDate implements ConstraintValidator<Past, Date> { public boolean isValid(Date date, ConstraintValidatorContext constraintValidatorContext) { if ( date == null ) { return true; } return date.before( new Date() ); }  void initialize(Past constraintAnnotation); boolean isValid(Date date, ConstraintValidatorContext constraintValidatorContext);  }### Answer:
@Test public void testIsValid() { Date futureDate = getFutureDate(); Date pastDate = getPastDate(); assertTrue( constraint.isValid( null, null ) ); assertTrue( constraint.isValid( pastDate, null ) ); assertFalse( constraint.isValid( new Date(), null ) ); assertFalse( constraint.isValid( futureDate, null ) ); }