public static void setOutputPath(Job job, Path outputDir) {
    try {
      outputDir = outputDir.getFileSystem(job.getConfiguration()).makeQualified(
          outputDir);
    } catch (IOException e) {
        // Throw the IOException as a RuntimeException to be compatible with MR1
        throw new RuntimeException(e);
    }
    job.getConfiguration().set(FileOutputFormat.OUTDIR, outputDir.toString());
  }
@Test
  public void testSetOutputPathException() throws Exception {
    Job job = Job.getInstance();
    try {
      // Give it an invalid filesystem so it'll throw an exception
      FileOutputFormat.setOutputPath(job, new Path("foo:///bar"));
      fail("Should have thrown a RuntimeException with an IOException inside");
    }
    catch (RuntimeException re) {
      assertTrue(re.getCause() instanceof IOException);
    }
  }