### Question:
FileAgeValidator implements Validator { @Override public <T> boolean validate(T obj) { File file = (File) obj; Calendar fileDate = getFileDate(file); Calendar ageLimit = getFileAgeLimit(); boolean retVal = false; if (fileDate.after(ageLimit)) { retVal = true; } return retVal; }  @Override boolean validate(T obj);  }### Answer:
@Test public void testValidator_pass_for_young_file() { long now = System.currentTimeMillis(); when(file.lastModified()).thenReturn(now); assertTrue(instance.validate(file)); }
@Test public void testValidator_fail_for_old_file() { long now = 1000L; when(file.lastModified()).thenReturn(now); assertFalse(instance.validate(file)); }
@Test public void testValidator_pass_for_file_below_limit() { long now = System.currentTimeMillis() - MILLIS_IN_TWO_DAYS + 1000; when(file.lastModified()).thenReturn(now); assertTrue(instance.validate(file)); }
@Test public void testValidator_fail_for_file_just_above_limit() { long now = System.currentTimeMillis() - MILLIS_IN_TWO_DAYS - 1000; when(file.lastModified()).thenReturn(now); assertFalse(instance.validate(file)); }
@Test public void testValidator_fail_for_file_on_limit() { long now = System.currentTimeMillis() - MILLIS_IN_TWO_DAYS; when(file.lastModified()).thenReturn(now); assertFalse(instance.validate(file)); }