### Question:
DistCache { public static void addJarToDistributedCache(Configuration conf, File jarFile) throws IOException { if (!jarFile.exists()) { throw new IOException("Jar file: " + jarFile.getCanonicalPath() + " does not exist."); } if (!jarFile.getName().endsWith(".jar")) { throw new IllegalArgumentException("File: " + jarFile.getCanonicalPath() + " is not a .jar " + "file."); } FileSystem fileSystem = FileSystem.getLocal(conf); Path jarPath = new Path(jarFile.getCanonicalPath()); String qualifiedPath = jarPath.makeQualified(fileSystem).toString(); String jarConfiguration = conf.get(TMPJARS_KEY, ""); if (!jarConfiguration.isEmpty()) { jarConfiguration += ","; } jarConfiguration += qualifiedPath; conf.set(TMPJARS_KEY, jarConfiguration); }  static void write(Configuration conf, Path path, Object value); static Object read(Configuration conf, Path path); static void addJarToDistributedCache(Configuration conf, File jarFile); static void addJarToDistributedCache(Configuration conf, String jarFile); static String findContainingJar(Class jarClass); static void addJarDirToDistributedCache(Configuration conf, File jarDirectory); static void addJarDirToDistributedCache(Configuration conf, String jarDirectory);  }### Answer:
@Test public void testAddJar() throws IOException { for (int i = 0; i < testFilePaths.length; i++) { DistCache.addJarToDistributedCache(testConf, testFilePaths[i]); assertEquals("tmpjars configuration var does not contain expected value.", StringUtils.join(testFileQualifiedPaths, ",", 0, i + 1), testConf.get("tmpjars")); } }
@Test(expected = IOException.class) public void testAddJarThatDoesntExist() throws IOException { DistCache.addJarToDistributedCache(testConf, "/garbage/doesntexist.jar"); }