@Test
public void testDetermineTimestamps() throws IOException {

  Job job = Job.getInstance(conf);
  job.addCacheFile(firstCacheFile.toUri());
  job.addCacheFile(secondCacheFile.toUri());
  Configuration jobConf = job.getConfiguration();
  
  Map<URI, FileStatus> statCache = new HashMap<>();
  ClientDistributedCacheManager.determineTimestamps(jobConf, statCache);
  
  FileStatus firstStatus = statCache.get(firstCacheFile.toUri());
  FileStatus secondStatus = statCache.get(secondCacheFile.toUri());
  
  assertNotNull(firstCacheFile + " was not found in the stats cache",
      firstStatus);
  assertNotNull(secondCacheFile + " was not found in the stats cache",
      secondStatus);
  assertEquals("Missing/extra entries found in the stats cache",
      2, statCache.size());
  String expected = firstStatus.getModificationTime() + ","
      + secondStatus.getModificationTime();
  assertEquals(expected, jobConf.get(MRJobConfig.CACHE_FILE_TIMESTAMPS));
  job = Job.getInstance(conf);
  job.addCacheFile(new Path(TEST_VISIBILITY_CHILD_DIR, "*").toUri());
  jobConf = job.getConfiguration();
  statCache.clear();
  ClientDistributedCacheManager.determineTimestamps(jobConf, statCache);
  FileStatus thirdStatus = statCache.get(TEST_VISIBILITY_CHILD_DIR.toUri());
  assertEquals("Missing/extra entries found in the stats cache",
      1, statCache.size());
  assertNotNull(TEST_VISIBILITY_CHILD_DIR
      + " was not found in the stats cache", thirdStatus);
  expected = Long.toString(thirdStatus.getModificationTime());
  assertEquals("Incorrect timestamp for " + TEST_VISIBILITY_CHILD_DIR,
      expected, jobConf.get(MRJobConfig.CACHE_FILE_TIMESTAMPS));
}