assertEquals(2, countFiles);
}
@Test
public void testWildcardFile() {
FindFile ff = new WildcardFindFile()
.include("**/*file/a*")
.setRecursive(true)
.setIncludeDirs(true)
.searchPath(dataRoot);
int countDirs = 0;
int countFiles = 0;
File f;
while ((f = ff.nextFile()) != null) {
if (f.isDirectory() == true) {
countDirs++;
} else {
countFiles++;
String path = f.getAbsolutePath();
path = FileNameUtil.separatorsToUnix(path);
if (path.startsWith("/") == false) {
path = '/' + path;
}
boolean matched =
path.equals(dataRoot + "/file/a.png") ||
path.equals(dataRoot + "/file/a.txt");
assertTrue(matched);
}
}
assertEquals(0, countDirs);
assertEquals(2, countFiles);
ff.searchPath(dataRoot);
countDirs = 0;
countFiles = 0;
Iterator<File> iterator = ff.iterator();
while (iterator.hasNext()) {
f = iterator.next();
if (f.isDirectory() == true) {