FileUtils { public static boolean isValidDirectory(final File file) { return file.isDirectory() && file.canRead() && !file.isHidden(); } private  FileUtils(); static boolean isValidFile(final File file); static boolean isValidDirectory(final File file); static List<File> listChildren(final String parentPath, final boolean includeFiles);  }
@Test public void testIsValidDirectory() { File file = new File("file") { @Override public boolean isDirectory() { return true; } @Override public boolean canRead() { return true; } @Override public boolean isHidden() { return false; } }; assertTrue(isValidDirectory(file)); }
@Test public void testIsValidDirectoryNotDirectory() { File file = new File("file") { @Override public boolean isDirectory() { return false; } }; assertFalse(isValidDirectory(file)); }
@Test public void testIsValidDirectoryNotReadable() { File file = new File("file") { @Override public boolean isDirectory() { return true; } @Override public boolean canRead() { return false; } }; assertFalse(isValidDirectory(file)); }
@Test public void testIsValidDirectoryHidden() { File file = new File("file") { @Override public boolean isDirectory() { return true; } @Override public boolean canRead() { return true; } @Override public boolean isHidden() { return true; } }; assertFalse(isValidDirectory(file)); }