dirExists = false;
}
}
// Creating a filter that catches "*.tst" files.
FilenameFilter tstFilter = new FilenameFilter() {
public boolean accept(File f, String fileName) {
return fileName.endsWith(".tst");
}
};
assertNull("listFiles Should Return Null.", dir.listFiles(tstFilter));
assertTrue("Failed To Create Parent Directory.", dir.mkdir());
String[] files = { "1.tst", "2.tst", "3.tmp" };
try {
assertEquals("listFiles Should Return An Array Of Length 0.", 0,
dir.listFiles(tstFilter).length);
FileWrapper file = new FileWrapperImpl(dir, "notADir.tst");
try {
FileOutputStream fos = new FileOutputStream(file.getAbsolutePath());
fos.close();
assertNull(
"listFiles Should Have Returned Null When Used On A File Instead Of A Directory.",
file.listFiles(tstFilter));
} finally {
file.delete();
}
for (int i = 0; i < files.length; i++) {
FileWrapper f = new FileWrapperImpl(dir, files[i]);
FileOutputStream fos = new FileOutputStream(f.getAbsolutePath());
fos.close();
}
// Creating a filter that catches "*.tmp" files.
FilenameFilter tmpFilter = new FilenameFilter() {
public boolean accept(File f, String fileName) {
// If the suffix is ".tmp" then send it to the array
if (fileName.endsWith(".tmp")) {
return true;
} else {