aboutsummaryrefslogtreecommitdiffstats
path: root/util/testsrc
diff options
context:
space:
mode:
authorwisberg <wisberg>2005-06-08 23:33:01 +0000
committerwisberg <wisberg>2005-06-08 23:33:01 +0000
commitd851660694dc1ee5d44d0ffb3bf2381559e8ceb4 (patch)
tree1eaff217ffca1bd9a9d07c7662d7ece3bada610b /util/testsrc
parentec99a1f3fed8237f2df73a5063d7039d762afa8d (diff)
downloadaspectj-d851660694dc1ee5d44d0ffb3bf2381559e8ceb4.tar.gz
aspectj-d851660694dc1ee5d44d0ffb3bf2381559e8ceb4.zip
getBestFile(String[])
Diffstat (limited to 'util/testsrc')
-rw-r--r--util/testsrc/org/aspectj/util/FileUtilTest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/util/testsrc/org/aspectj/util/FileUtilTest.java b/util/testsrc/org/aspectj/util/FileUtilTest.java
index da2757009..c54080936 100644
--- a/util/testsrc/org/aspectj/util/FileUtilTest.java
+++ b/util/testsrc/org/aspectj/util/FileUtilTest.java
@@ -212,6 +212,29 @@ public class FileUtilTest extends TestCase {
assertTrue(!noSuchFile.isDirectory());
}
+ public void testGetBestFile() {
+ assertNull(FileUtil.getBestFile((String[]) null));
+ assertNull(FileUtil.getBestFile(new String[0]));
+ assertNull(FileUtil.getBestFile(new String[] {"!"}));
+ File f = FileUtil.getBestFile(new String[] {"."});
+ assertNotNull(f);
+ f = FileUtil.getBestFile(new String[] {"!", "."});
+ assertNotNull(f);
+ assertTrue(f.canRead());
+ boolean setProperty = false;
+ try {
+ System.setProperty("bestfile", ".");
+ setProperty = true;
+ } catch (Throwable t) {
+ // ignore Security, etc.
+ }
+ if (setProperty) {
+ f = FileUtil.getBestFile(new String[] {"sp:bestfile"});
+ assertNotNull(f);
+ assertTrue(f.canRead());
+ }
+ }
+
public void testCopyFiles() {
// bad input
Class iaxClass = IllegalArgumentException.class;