public static List<Path> getJarsInDirectory(String path) {
    return getJarsInDirectory(path, true);
  }
@Test
  public void testGetJarsInDirectory() throws Exception {
    List<Path> jars = FileUtil.getJarsInDirectory("/foo/bar/bogus/");
    assertTrue("no jars should be returned for a bogus path",
        jars.isEmpty());


    // create jar files to be returned
    File jar1 = new File(tmp, "wildcard1.jar");
    File jar2 = new File(tmp, "wildcard2.JAR");
    List<File> matches = Arrays.asList(jar1, jar2);
    for (File match: matches) {
      assertTrue("failure creating file: " + match, match.createNewFile());
    }

    // create non-jar files, which we expect to not be included in the result
    Verify.createNewFile(new File(tmp, "text.txt"));
    Verify.createNewFile(new File(tmp, "executable.exe"));
    Verify.createNewFile(new File(tmp, "README"));

    // pass in the directory
    String directory = tmp.getCanonicalPath();
    jars = FileUtil.getJarsInDirectory(directory);
    assertEquals("there should be 2 jars", 2, jars.size());
    for (Path jar: jars) {
      URL url = jar.toUri().toURL();
      assertTrue("the jar should match either of the jars",
          url.equals(jar1.getCanonicalFile().toURI().toURL()) ||
          url.equals(jar2.getCanonicalFile().toURI().toURL()));
    }
  }