FileUtils { public static boolean isValidFile(final File file) { return file.isFile() && 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 testIsValidFile() { File file = new File("file") { @Override public boolean isFile() { return true; } @Override public boolean canRead() { return true; } @Override public boolean isHidden() { return false; } }; assertTrue(isValidFile(file)); }
@Test public void testIsValidFileNotFile() { File file = new File("file") { @Override public boolean isFile() { return false; } }; assertFalse(isValidFile(file)); }
@Test public void testIsValidFileNotReadable() { File file = new File("file") { @Override public boolean isFile() { return true; } @Override public boolean canRead() { return false; } }; assertFalse(isValidFile(file)); }
@Test public void testIsValidFileHidden() { File file = new File("file") { @Override public boolean canRead() { return true; } @Override public boolean isFile() { return true; } @Override public boolean isHidden() { return true; } }; assertFalse(isValidFile(file)); }