@Test
public void testListDirectory() throws IOException {

  File dir = new File("testListDirectory");
  Files.createDirectory(dir.toPath());
  try {
    Set<String> entries = new HashSet<String>();
    entries.add("entry1");
    entries.add("entry2");
    entries.add("entry3");
    for (String entry : entries) {
      Files.createDirectory(new File(dir, entry).toPath());
    }
    List<String> list = IOUtils.listDirectory(dir,
        NoEntry3Filter.INSTANCE);
    for (String entry : list) {
      Assert.assertTrue(entries.remove(entry));
    }
    Assert.assertTrue(entries.contains("entry3"));
    list = IOUtils.listDirectory(dir, null);
    for (String entry : list) {
      entries.remove(entry);
    }
    Assert.assertTrue(entries.isEmpty());
  } finally {
    FileUtils.deleteDirectory(dir);
  }
}