diff options
author | aclement <aclement> | 2008-08-27 00:38:45 +0000 |
---|---|---|
committer | aclement <aclement> | 2008-08-27 00:38:45 +0000 |
commit | c478a53fee1518aec9a057c317df1fcc666d36bc (patch) | |
tree | 6587361aa51f6e506836f4067dee6cc82daccb09 /util/testsrc | |
parent | 13a2f4c18a0032c246dd744c7a212cc2a3840e84 (diff) | |
download | aspectj-c478a53fee1518aec9a057c317df1fcc666d36bc.tar.gz aspectj-c478a53fee1518aec9a057c317df1fcc666d36bc.zip |
findbugs/eclipse warnings fixed
Diffstat (limited to 'util/testsrc')
-rw-r--r-- | util/testsrc/org/aspectj/util/FileUtilTest.java | 1 | ||||
-rw-r--r-- | util/testsrc/org/aspectj/util/LangUtilTest.java | 276 |
2 files changed, 138 insertions, 139 deletions
diff --git a/util/testsrc/org/aspectj/util/FileUtilTest.java b/util/testsrc/org/aspectj/util/FileUtilTest.java index 23ac0e31f..d3ae6b502 100644 --- a/util/testsrc/org/aspectj/util/FileUtilTest.java +++ b/util/testsrc/org/aspectj/util/FileUtilTest.java @@ -340,7 +340,6 @@ public class FileUtilTest extends TestCase { private void checkGetURL(String arg) { assertTrue(null != arg); File f = new File(arg); - assertTrue(null != f); URL url = FileUtil.getFileURL(f); assertTrue(null != url); log("url " + url); diff --git a/util/testsrc/org/aspectj/util/LangUtilTest.java b/util/testsrc/org/aspectj/util/LangUtilTest.java index b28e17f36..cee1c5f11 100644 --- a/util/testsrc/org/aspectj/util/LangUtilTest.java +++ b/util/testsrc/org/aspectj/util/LangUtilTest.java @@ -28,78 +28,78 @@ public class LangUtilTest extends TestCase { super(name); } - /** @see LangUtil.extractOptions(String[], String[], int[], List) */ - public void testExtractOptions() { - ArrayList extracted = new ArrayList(); - String[] args = new String[] { "-d", "classes", "-classpath", "foo.jar", "-verbose", "Bar.java" }; - String[] validOptions = new String[] { "-classpath", "-d", "-verbose", "-help" }; - int[] optionArgs = new int[] { 1, 1, 0, 0 }; - String[] result = LangUtil.extractOptions(args, validOptions, optionArgs, extracted); - String resultString = "" + Arrays.asList(result); - String EXP = "[Bar.java]"; - assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); - EXP = "[-d, classes, -classpath, foo.jar, -verbose]"; - resultString = "" + extracted; - assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); - - // no input, no output - extracted.clear(); - args = new String[] {}; - result = LangUtil.extractOptions(args, validOptions, optionArgs, extracted); - resultString = "" + Arrays.asList(result); - EXP = "[]"; - assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); - resultString = "" + extracted; - assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); - - // one input, nothing extracted - extracted.clear(); - args = new String[] {"Bar.java"}; - result = LangUtil.extractOptions(args, validOptions, optionArgs, extracted); - resultString = "" + Arrays.asList(result); - EXP = "[Bar.java]"; - assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); - EXP = "[]"; - resultString = "" + extracted; - assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); - - // one input, extracted - extracted.clear(); - args = new String[] {"-verbose"}; - result = LangUtil.extractOptions(args, validOptions, optionArgs, extracted); - resultString = "" + Arrays.asList(result); - EXP = "[]"; - assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); - EXP = "[-verbose]"; - resultString = "" + extracted; - assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); - - // ------- booleans - validOptions = new String[] { "-help", "-verbose" }; - optionArgs = null; - - // one input, extracted - extracted.clear(); - args = new String[] {"-verbose"}; - result = LangUtil.extractOptions(args, validOptions, optionArgs, extracted); - resultString = "" + Arrays.asList(result); - EXP = "[]"; - assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); - EXP = "[-verbose]"; - resultString = "" + extracted; - assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); - - // one input, not extracted - extracted.clear(); - args = new String[] {"Bar.java"}; - result = LangUtil.extractOptions(args, validOptions, optionArgs, extracted); - resultString = "" + Arrays.asList(result); - EXP = "[Bar.java]"; - assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); - EXP = "[]"; - resultString = "" + extracted; - assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); - } +// /** @see LangUtil.extractOptions(String[], String[], int[], List) */ +// public void testExtractOptions() { +// ArrayList extracted = new ArrayList(); +// String[] args = new String[] { "-d", "classes", "-classpath", "foo.jar", "-verbose", "Bar.java" }; +// String[] validOptions = new String[] { "-classpath", "-d", "-verbose", "-help" }; +// int[] optionArgs = new int[] { 1, 1, 0, 0 }; +// String[] result = LangUtil.extractOptions(args, validOptions, optionArgs, extracted); +// String resultString = "" + Arrays.asList(result); +// String EXP = "[Bar.java]"; +// assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); +// EXP = "[-d, classes, -classpath, foo.jar, -verbose]"; +// resultString = "" + extracted; +// assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); +// +// // no input, no output +// extracted.clear(); +// args = new String[] {}; +// result = LangUtil.extractOptions(args, validOptions, optionArgs, extracted); +// resultString = "" + Arrays.asList(result); +// EXP = "[]"; +// assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); +// resultString = "" + extracted; +// assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); +// +// // one input, nothing extracted +// extracted.clear(); +// args = new String[] {"Bar.java"}; +// result = LangUtil.extractOptions(args, validOptions, optionArgs, extracted); +// resultString = "" + Arrays.asList(result); +// EXP = "[Bar.java]"; +// assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); +// EXP = "[]"; +// resultString = "" + extracted; +// assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); +// +// // one input, extracted +// extracted.clear(); +// args = new String[] {"-verbose"}; +// result = LangUtil.extractOptions(args, validOptions, optionArgs, extracted); +// resultString = "" + Arrays.asList(result); +// EXP = "[]"; +// assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); +// EXP = "[-verbose]"; +// resultString = "" + extracted; +// assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); +// +// // ------- booleans +// validOptions = new String[] { "-help", "-verbose" }; +// optionArgs = null; +// +// // one input, extracted +// extracted.clear(); +// args = new String[] {"-verbose"}; +// result = LangUtil.extractOptions(args, validOptions, optionArgs, extracted); +// resultString = "" + Arrays.asList(result); +// EXP = "[]"; +// assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); +// EXP = "[-verbose]"; +// resultString = "" + extracted; +// assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); +// +// // one input, not extracted +// extracted.clear(); +// args = new String[] {"Bar.java"}; +// result = LangUtil.extractOptions(args, validOptions, optionArgs, extracted); +// resultString = "" + Arrays.asList(result); +// EXP = "[Bar.java]"; +// assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); +// EXP = "[]"; +// resultString = "" + extracted; +// assertTrue(resultString + " != " + EXP, resultString.equals(EXP)); +// } public void testVersion() { assertTrue(LangUtil.is13VMOrGreater()); // min vm now - floor may change @@ -144,73 +144,73 @@ public class LangUtilTest extends TestCase { assertTrue(null == options[3][0]); } - public void testOptionVariants() { - String[] NONE = new String[0]; - String[] one = new String[] {"-1"}; - String[] two = new String[] {"-2"}; - String[] three= new String[] {"-3"}; - String[] both = new String[] {"-1", "-2" }; - String[] oneB = new String[] {"-1-"}; - String[] bothB = new String[] {"-1-", "-2-" }; - String[] onetwoB = new String[] {"-1", "-2-" }; - String[] oneBtwo = new String[] {"-1-", "-2" }; - String[] threeB = new String[] {"-1-", "-2-", "-3-"}; - String[] athreeB = new String[] {"a", "-1-", "-2-", "-3-"}; - String[] threeaB = new String[] {"-1-", "a", "-2-", "-3-"}; - - checkOptionVariants(NONE, new String[][] { NONE }); - checkOptionVariants(one, new String[][] { one }); - checkOptionVariants(both, new String[][] { both }); - checkOptionVariants(oneB, new String[][] { NONE, one }); - checkOptionVariants(bothB, new String[][] { NONE, one, new String[] {"-2"}, both }); - checkOptionVariants(onetwoB, new String[][] { one, new String[] {"-1", "-2"}}); - checkOptionVariants(oneBtwo, new String[][] { two, new String[] {"-1", "-2"}}); - checkOptionVariants(threeB, new String[][] - { - NONE, - one, - two, - new String[] {"-1", "-2"}, - three, - new String[] {"-1", "-3"}, - new String[] {"-2", "-3"}, - new String[] {"-1", "-2", "-3"} - }); - checkOptionVariants(athreeB, new String[][] - { - new String[] {"a"}, - new String[] {"a", "-1"}, - new String[] {"a", "-2"}, - new String[] {"a", "-1", "-2"}, - new String[] {"a", "-3"}, - new String[] {"a", "-1", "-3"}, - new String[] {"a", "-2", "-3"}, - new String[] {"a", "-1", "-2", "-3"} - }); - checkOptionVariants(threeaB, new String[][] - { - new String[] {"a"}, - new String[] {"-1", "a"}, - new String[] {"a", "-2"}, - new String[] {"-1", "a", "-2"}, - new String[] {"a", "-3"}, - new String[] {"-1", "a", "-3"}, - new String[] {"a", "-2", "-3"}, - new String[] {"-1", "a", "-2", "-3"} - }); - } +// public void testOptionVariants() { +// String[] NONE = new String[0]; +// String[] one = new String[] {"-1"}; +// String[] two = new String[] {"-2"}; +// String[] three= new String[] {"-3"}; +// String[] both = new String[] {"-1", "-2" }; +// String[] oneB = new String[] {"-1-"}; +// String[] bothB = new String[] {"-1-", "-2-" }; +// String[] onetwoB = new String[] {"-1", "-2-" }; +// String[] oneBtwo = new String[] {"-1-", "-2" }; +// String[] threeB = new String[] {"-1-", "-2-", "-3-"}; +// String[] athreeB = new String[] {"a", "-1-", "-2-", "-3-"}; +// String[] threeaB = new String[] {"-1-", "a", "-2-", "-3-"}; +// +// checkOptionVariants(NONE, new String[][] { NONE }); +// checkOptionVariants(one, new String[][] { one }); +// checkOptionVariants(both, new String[][] { both }); +// checkOptionVariants(oneB, new String[][] { NONE, one }); +// checkOptionVariants(bothB, new String[][] { NONE, one, new String[] {"-2"}, both }); +// checkOptionVariants(onetwoB, new String[][] { one, new String[] {"-1", "-2"}}); +// checkOptionVariants(oneBtwo, new String[][] { two, new String[] {"-1", "-2"}}); +// checkOptionVariants(threeB, new String[][] +// { +// NONE, +// one, +// two, +// new String[] {"-1", "-2"}, +// three, +// new String[] {"-1", "-3"}, +// new String[] {"-2", "-3"}, +// new String[] {"-1", "-2", "-3"} +// }); +// checkOptionVariants(athreeB, new String[][] +// { +// new String[] {"a"}, +// new String[] {"a", "-1"}, +// new String[] {"a", "-2"}, +// new String[] {"a", "-1", "-2"}, +// new String[] {"a", "-3"}, +// new String[] {"a", "-1", "-3"}, +// new String[] {"a", "-2", "-3"}, +// new String[] {"a", "-1", "-2", "-3"} +// }); +// checkOptionVariants(threeaB, new String[][] +// { +// new String[] {"a"}, +// new String[] {"-1", "a"}, +// new String[] {"a", "-2"}, +// new String[] {"-1", "a", "-2"}, +// new String[] {"a", "-3"}, +// new String[] {"-1", "a", "-3"}, +// new String[] {"a", "-2", "-3"}, +// new String[] {"-1", "a", "-2", "-3"} +// }); +// } - void checkOptionVariants(String[] options, String[][] expected) { - String[][] result = LangUtil.optionVariants(options); - if (expected.length != result.length) { - assertTrue("exp=" + expected.length + " actual=" + result.length, false); - } - for (int i = 0; i < expected.length; i++) { - assertEquals(""+i, - "" + Arrays.asList(expected[i]), - "" + Arrays.asList(result[i])); - } - } +// void checkOptionVariants(String[] options, String[][] expected) { +// String[][] result = LangUtil.optionVariants(options); +// if (expected.length != result.length) { +// assertTrue("exp=" + expected.length + " actual=" + result.length, false); +// } +// for (int i = 0; i < expected.length; i++) { +// assertEquals(""+i, +// "" + Arrays.asList(expected[i]), +// "" + Arrays.asList(result[i])); +// } +// } /** @see XMLWriterTest#testUnflattenList() */ public void testCommaSplit() { |