@Test
public void testCollectPackages() throws IOException, UploaderException {

  File parent = new File(testDir);
  try {
    parent.deleteOnExit();
    Assert.assertTrue("Directory creation failed", parent.mkdirs());
    File dirA = new File(parent, "A");
    Assert.assertTrue(dirA.mkdirs());
    File dirB = new File(parent, "B");
    Assert.assertTrue(dirB.mkdirs());
    File jarA = new File(dirA, "a.jar");
    Assert.assertTrue(jarA.createNewFile());
    File jarB = new File(dirA, "b.jar");
    Assert.assertTrue(jarB.createNewFile());
    File jarC = new File(dirA, "c.jar");
    Assert.assertTrue(jarC.createNewFile());
    File txtD = new File(dirA, "d.txt");
    Assert.assertTrue(txtD.createNewFile());
    File jarD = new File(dirB, "d.jar");
    Assert.assertTrue(jarD.createNewFile());
    File txtE = new File(dirB, "e.txt");
    Assert.assertTrue(txtE.createNewFile());
    FrameworkUploader uploader = new FrameworkUploader();
    uploader.whitelist = ".*a\\.jar,.*b\\.jar,.*d\\.jar";
    uploader.blacklist = ".*b\\.jar";
    uploader.input = dirA.getAbsolutePath() + File.separatorChar + "*" +
        File.pathSeparatorChar +
        dirB.getAbsolutePath() + File.separatorChar + "*";
    uploader.collectPackages();
    Assert.assertEquals("Whitelist count error", 3,
        uploader.whitelistedFiles.size());
    Assert.assertEquals("Blacklist count error", 1,
        uploader.blacklistedFiles.size());
    Assert.assertTrue("File not collected",
        uploader.filteredInputFiles.contains(jarA.getAbsolutePath()));
    Assert.assertFalse("File collected",
        uploader.filteredInputFiles.contains(jarB.getAbsolutePath()));
    Assert.assertTrue("File not collected",
        uploader.filteredInputFiles.contains(jarD.getAbsolutePath()));
    Assert.assertEquals("Too many whitelists", 2,
        uploader.filteredInputFiles.size());
  } finally {
    FileUtils.deleteDirectory(parent);
  }
}