  @Test
  public void testAddJarDirectory() throws IOException {

    DistCache.addJarDirToDistributedCache(testConf, testFolder.getRoot().getCanonicalPath());
    // Throw the added jar paths in a set to detect duplicates.
    String[] splitJarPaths = StringUtils.split(testConf.get("tmpjars"), ",");
    Set<String> addedJarPaths = new HashSet<String>();
    for (String path: splitJarPaths) {
      addedJarPaths.add(path);
    }
    assertEquals("Incorrect number of jar paths added.", testFilePaths.length,
        addedJarPaths.size());

    // Ensure all expected paths were added.
    for (int i = 0; i < testFileQualifiedPaths.length; i++) {
      assertTrue("Expected jar path missing from jar paths added to tmpjars: " +
          testFileQualifiedPaths[i], addedJarPaths.contains(testFileQualifiedPaths[i]));
    }
  }