public void unJar(File jarFile, File toDir) throws IOException {
    unJar(jarFile, toDir, MATCH_ANY);
  }
@Test
  public void testUnJar2() throws IOException {
    // make a simple zip
    File jarFile = new File(TEST_ROOT_DIR, TEST_JAR_NAME);
    JarOutputStream jstream =
        new JarOutputStream(new FileOutputStream(jarFile));
    JarEntry je = new JarEntry("META-INF/MANIFEST.MF");
    byte[] data = "Manifest-Version: 1.0\nCreated-By: 1.8.0_1 (Manual)"
        .getBytes(StandardCharsets.UTF_8);
    je.setSize(data.length);
    jstream.putNextEntry(je);
    jstream.write(data);
    jstream.closeEntry();
    je = new JarEntry("../outside.path");
    data = "any data here".getBytes(StandardCharsets.UTF_8);
    je.setSize(data.length);
    jstream.putNextEntry(je);
    jstream.write(data);
    jstream.closeEntry();
    jstream.close();

    File unjarDir = getUnjarDir("unjar-path");

    // Unjar everything
    try {
      RunJar.unJar(jarFile, unjarDir, MATCH_ANY);
      fail("unJar should throw IOException.");
    } catch (IOException e) {
      GenericTestUtils.assertExceptionContains(
          "would create file outside of", e);
    }
    try {
      RunJar.unJar(new FileInputStream(jarFile), unjarDir, MATCH_ANY);
      fail("unJar should throw IOException.");
    } catch (IOException e) {
      GenericTestUtils.assertExceptionContains(
          "would create file outside of", e);
    }
  }