From d851660694dc1ee5d44d0ffb3bf2381559e8ceb4 Mon Sep 17 00:00:00 2001 From: wisberg Date: Wed, 8 Jun 2005 23:33:01 +0000 Subject: getBestFile(String[]) --- util/testsrc/org/aspectj/util/FileUtilTest.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'util/testsrc/org') 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; -- cgit v1.2.3