git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269814 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -17,6 +17,9 @@ Other changes: | |||||
| * Added a new condition <isset> that test for the existence of a | * Added a new condition <isset> that test for the existence of a | ||||
| property to the condition task. | property to the condition task. | ||||
| * Ant's testcases require JUnit 3.7 or above as they now use the new | |||||
| assertTrue method instead of assert. | |||||
| Fixed bugs: | Fixed bugs: | ||||
| ----------- | ----------- | ||||
| @@ -87,8 +87,8 @@ public class DirectoryScannerTest extends TestCase { | |||||
| haveTaskdefsPackage = true; | haveTaskdefsPackage = true; | ||||
| } | } | ||||
| } | } | ||||
| assert("(1) zip package included", haveZipPackage); | |||||
| assert("(1) taskdefs package not included", !haveTaskdefsPackage); | |||||
| assertTrue("(1) zip package included", haveZipPackage); | |||||
| assertTrue("(1) taskdefs package not included", !haveTaskdefsPackage); | |||||
| ds = new DirectoryScanner(); | ds = new DirectoryScanner(); | ||||
| ds.setBasedir(dir); | ds.setBasedir(dir); | ||||
| @@ -103,8 +103,8 @@ public class DirectoryScannerTest extends TestCase { | |||||
| haveTaskdefsPackage = true; | haveTaskdefsPackage = true; | ||||
| } | } | ||||
| } | } | ||||
| assert("(2) zip package included", haveZipPackage); | |||||
| assert("(2) taskdefs package included", haveTaskdefsPackage); | |||||
| assertTrue("(2) zip package included", haveZipPackage); | |||||
| assertTrue("(2) taskdefs package included", haveTaskdefsPackage); | |||||
| } | } | ||||
| @@ -94,15 +94,15 @@ public class IntrospectionHelperTest extends TestCase { | |||||
| ih.addText(p, this, "test2"); | ih.addText(p, this, "test2"); | ||||
| fail("test2 shouldn\'t be equal to test"); | fail("test2 shouldn\'t be equal to test"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof AssertionFailedError); | |||||
| assertTrue(be.getException() instanceof AssertionFailedError); | |||||
| } | } | ||||
| } | } | ||||
| public void testSupportsCharacters() { | public void testSupportsCharacters() { | ||||
| IntrospectionHelper ih = IntrospectionHelper.getHelper(java.lang.String.class); | IntrospectionHelper ih = IntrospectionHelper.getHelper(java.lang.String.class); | ||||
| assert("String doesn\'t support addText", !ih.supportsCharacters()); | |||||
| assertTrue("String doesn\'t support addText", !ih.supportsCharacters()); | |||||
| ih = IntrospectionHelper.getHelper(getClass()); | ih = IntrospectionHelper.getHelper(getClass()); | ||||
| assert("IntrospectionHelperTest supports addText", | |||||
| assertTrue("IntrospectionHelperTest supports addText", | |||||
| ih.supportsCharacters()); | ih.supportsCharacters()); | ||||
| } | } | ||||
| @@ -177,14 +177,14 @@ public class IntrospectionHelperTest extends TestCase { | |||||
| ih.createElement(p, this, "fourteen"); | ih.createElement(p, this, "fourteen"); | ||||
| fail("fourteen throws NullPointerException"); | fail("fourteen throws NullPointerException"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof NullPointerException); | |||||
| assertTrue(be.getException() instanceof NullPointerException); | |||||
| } | } | ||||
| try { | try { | ||||
| ih.createElement(p, this, "fourteen"); | ih.createElement(p, this, "fourteen"); | ||||
| fail("fifteen throws NullPointerException"); | fail("fifteen throws NullPointerException"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof NullPointerException); | |||||
| assertTrue(be.getException() instanceof NullPointerException); | |||||
| } | } | ||||
| } | } | ||||
| @@ -204,7 +204,7 @@ public class IntrospectionHelperTest extends TestCase { | |||||
| assertEquals("Return type of "+name, expect, ih.getElementType(name)); | assertEquals("Return type of "+name, expect, ih.getElementType(name)); | ||||
| h.remove(name); | h.remove(name); | ||||
| } | } | ||||
| assert("Found all", h.isEmpty()); | |||||
| assertTrue("Found all", h.isEmpty()); | |||||
| } | } | ||||
| public Object createTwo(String s) { | public Object createTwo(String s) { | ||||
| @@ -288,76 +288,76 @@ public class IntrospectionHelperTest extends TestCase { | |||||
| ih.setAttribute(p, this, "seven", "3"); | ih.setAttribute(p, this, "seven", "3"); | ||||
| fail("2 shouldn't be equals to three"); | fail("2 shouldn't be equals to three"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof AssertionFailedError); | |||||
| assertTrue(be.getException() instanceof AssertionFailedError); | |||||
| } | } | ||||
| ih.setAttribute(p, this, "eight", "2"); | ih.setAttribute(p, this, "eight", "2"); | ||||
| try { | try { | ||||
| ih.setAttribute(p, this, "eight", "3"); | ih.setAttribute(p, this, "eight", "3"); | ||||
| fail("2 shouldn't be equals to three - as int"); | fail("2 shouldn't be equals to three - as int"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof AssertionFailedError); | |||||
| assertTrue(be.getException() instanceof AssertionFailedError); | |||||
| } | } | ||||
| ih.setAttribute(p, this, "nine", "2"); | ih.setAttribute(p, this, "nine", "2"); | ||||
| try { | try { | ||||
| ih.setAttribute(p, this, "nine", "3"); | ih.setAttribute(p, this, "nine", "3"); | ||||
| fail("2 shouldn't be equals to three - as Integer"); | fail("2 shouldn't be equals to three - as Integer"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof AssertionFailedError); | |||||
| assertTrue(be.getException() instanceof AssertionFailedError); | |||||
| } | } | ||||
| ih.setAttribute(p, this, "ten", "2"); | ih.setAttribute(p, this, "ten", "2"); | ||||
| try { | try { | ||||
| ih.setAttribute(p, this, "ten", "3"); | ih.setAttribute(p, this, "ten", "3"); | ||||
| fail("/tmp/2 shouldn't be equals to /tmp/3"); | fail("/tmp/2 shouldn't be equals to /tmp/3"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof AssertionFailedError); | |||||
| assertTrue(be.getException() instanceof AssertionFailedError); | |||||
| } | } | ||||
| ih.setAttribute(p, this, "eleven", "2"); | ih.setAttribute(p, this, "eleven", "2"); | ||||
| try { | try { | ||||
| ih.setAttribute(p, this, "eleven", "on"); | ih.setAttribute(p, this, "eleven", "on"); | ||||
| fail("on shouldn't be false"); | fail("on shouldn't be false"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof AssertionFailedError); | |||||
| assertTrue(be.getException() instanceof AssertionFailedError); | |||||
| } | } | ||||
| ih.setAttribute(p, this, "twelve", "2"); | ih.setAttribute(p, this, "twelve", "2"); | ||||
| try { | try { | ||||
| ih.setAttribute(p, this, "twelve", "on"); | ih.setAttribute(p, this, "twelve", "on"); | ||||
| fail("on shouldn't be false"); | fail("on shouldn't be false"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof AssertionFailedError); | |||||
| assertTrue(be.getException() instanceof AssertionFailedError); | |||||
| } | } | ||||
| ih.setAttribute(p, this, "thirteen", "org.apache.tools.ant.Project"); | ih.setAttribute(p, this, "thirteen", "org.apache.tools.ant.Project"); | ||||
| try { | try { | ||||
| ih.setAttribute(p, this, "thirteen", "org.apache.tools.ant.ProjectHelper"); | ih.setAttribute(p, this, "thirteen", "org.apache.tools.ant.ProjectHelper"); | ||||
| fail("org.apache.tools.ant.Project shouldn't be equal to org.apache.tools.ant.ProjectHelper"); | fail("org.apache.tools.ant.Project shouldn't be equal to org.apache.tools.ant.ProjectHelper"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof AssertionFailedError); | |||||
| assertTrue(be.getException() instanceof AssertionFailedError); | |||||
| } | } | ||||
| try { | try { | ||||
| ih.setAttribute(p, this, "thirteen", "org.apache.tools.ant.Project2"); | ih.setAttribute(p, this, "thirteen", "org.apache.tools.ant.Project2"); | ||||
| fail("org.apache.tools.ant.Project2 doesn't exist"); | fail("org.apache.tools.ant.Project2 doesn't exist"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof ClassNotFoundException); | |||||
| assertTrue(be.getException() instanceof ClassNotFoundException); | |||||
| } | } | ||||
| ih.setAttribute(p, this, "fourteen", "2"); | ih.setAttribute(p, this, "fourteen", "2"); | ||||
| try { | try { | ||||
| ih.setAttribute(p, this, "fourteen", "on"); | ih.setAttribute(p, this, "fourteen", "on"); | ||||
| fail("2 shouldn't be equals to three - as StringBuffer"); | fail("2 shouldn't be equals to three - as StringBuffer"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof AssertionFailedError); | |||||
| assertTrue(be.getException() instanceof AssertionFailedError); | |||||
| } | } | ||||
| ih.setAttribute(p, this, "fifteen", "abcd"); | ih.setAttribute(p, this, "fifteen", "abcd"); | ||||
| try { | try { | ||||
| ih.setAttribute(p, this, "fifteen", "on"); | ih.setAttribute(p, this, "fifteen", "on"); | ||||
| fail("o shouldn't be equal to a"); | fail("o shouldn't be equal to a"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof AssertionFailedError); | |||||
| assertTrue(be.getException() instanceof AssertionFailedError); | |||||
| } | } | ||||
| ih.setAttribute(p, this, "sixteen", "abcd"); | ih.setAttribute(p, this, "sixteen", "abcd"); | ||||
| try { | try { | ||||
| ih.setAttribute(p, this, "sixteen", "on"); | ih.setAttribute(p, this, "sixteen", "on"); | ||||
| fail("o shouldn't be equal to a"); | fail("o shouldn't be equal to a"); | ||||
| } catch (BuildException be) { | } catch (BuildException be) { | ||||
| assert(be.getException() instanceof AssertionFailedError); | |||||
| assertTrue(be.getException() instanceof AssertionFailedError); | |||||
| } | } | ||||
| } | } | ||||
| @@ -394,7 +394,7 @@ public class IntrospectionHelperTest extends TestCase { | |||||
| h.remove(name); | h.remove(name); | ||||
| } | } | ||||
| h.remove("name"); | h.remove("name"); | ||||
| assert("Found all", h.isEmpty()); | |||||
| assertTrue("Found all", h.isEmpty()); | |||||
| } | } | ||||
| public int setTwo(String s) { | public int setTwo(String s) { | ||||
| @@ -432,11 +432,11 @@ public class IntrospectionHelperTest extends TestCase { | |||||
| } | } | ||||
| public void setEleven(boolean b) { | public void setEleven(boolean b) { | ||||
| assert(!b); | |||||
| assertTrue(!b); | |||||
| } | } | ||||
| public void setTwelve(Boolean b) { | public void setTwelve(Boolean b) { | ||||
| assert(!b.booleanValue()); | |||||
| assertTrue(!b.booleanValue()); | |||||
| } | } | ||||
| public void setThirteen(Class c) { | public void setThirteen(Class c) { | ||||
| @@ -87,10 +87,10 @@ public class ProjectTest extends TestCase { | |||||
| p.createDataType("dummy")); | p.createDataType("dummy")); | ||||
| Object o = p.createDataType("fileset"); | Object o = p.createDataType("fileset"); | ||||
| assertNotNull("fileset is a known type", o); | assertNotNull("fileset is a known type", o); | ||||
| assert("fileset creates FileSet", o instanceof FileSet); | |||||
| assert("PatternSet", | |||||
| assertTrue("fileset creates FileSet", o instanceof FileSet); | |||||
| assertTrue("PatternSet", | |||||
| p.createDataType("patternset") instanceof PatternSet); | p.createDataType("patternset") instanceof PatternSet); | ||||
| assert("Path", p.createDataType("path") instanceof Path); | |||||
| assertTrue("Path", p.createDataType("path") instanceof Path); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -85,7 +85,7 @@ public class AvailableTest extends TaskdefsTest { | |||||
| // file doesn't exist -> property 'test' == null | // file doesn't exist -> property 'test' == null | ||||
| public void test4() { | public void test4() { | ||||
| executeTarget("test4"); | executeTarget("test4"); | ||||
| assert(project.getProperty("test") == null); | |||||
| assertTrue(project.getProperty("test") == null); | |||||
| } | } | ||||
| // file does exist -> property 'test' == 'true' | // file does exist -> property 'test' == 'true' | ||||
| @@ -97,7 +97,7 @@ public class AvailableTest extends TaskdefsTest { | |||||
| // resource doesn't exist -> property 'test' == null | // resource doesn't exist -> property 'test' == null | ||||
| public void test6() { | public void test6() { | ||||
| executeTarget("test6"); | executeTarget("test6"); | ||||
| assert(project.getProperty("test") == null); | |||||
| assertTrue(project.getProperty("test") == null); | |||||
| } | } | ||||
| // resource does exist -> property 'test' == 'true' | // resource does exist -> property 'test' == 'true' | ||||
| @@ -109,7 +109,7 @@ public class AvailableTest extends TaskdefsTest { | |||||
| // class doesn't exist -> property 'test' == null | // class doesn't exist -> property 'test' == null | ||||
| public void test8() { | public void test8() { | ||||
| executeTarget("test8"); | executeTarget("test8"); | ||||
| assert(project.getProperty("test") == null); | |||||
| assertTrue(project.getProperty("test") == null); | |||||
| } | } | ||||
| // class does exist -> property 'test' == 'true' | // class does exist -> property 'test' == 'true' | ||||
| @@ -106,7 +106,7 @@ public class CVSPassTest extends TaskdefsTest { | |||||
| executeTarget("test3"); | executeTarget("test3"); | ||||
| File f = new File(getProjectDir(), "testpassfile.tmp"); | File f = new File(getProjectDir(), "testpassfile.tmp"); | ||||
| assert( "Passfile "+f+" not created", f.exists()); | |||||
| assertTrue( "Passfile "+f+" not created", f.exists()); | |||||
| assertEquals(JAKARTA_URL+EOL, readFile(f)); | assertEquals(JAKARTA_URL+EOL, readFile(f)); | ||||
| @@ -116,7 +116,7 @@ public class CVSPassTest extends TaskdefsTest { | |||||
| executeTarget("test4"); | executeTarget("test4"); | ||||
| File f = new File(getProjectDir(), "testpassfile.tmp"); | File f = new File(getProjectDir(), "testpassfile.tmp"); | ||||
| assert( "Passfile "+f+" not created", f.exists()); | |||||
| assertTrue( "Passfile "+f+" not created", f.exists()); | |||||
| assertEquals( | assertEquals( | ||||
| JAKARTA_URL+ EOL+ | JAKARTA_URL+ EOL+ | ||||
| @@ -128,7 +128,7 @@ public class CVSPassTest extends TaskdefsTest { | |||||
| executeTarget("test5"); | executeTarget("test5"); | ||||
| File f = new File(getProjectDir(), "testpassfile.tmp"); | File f = new File(getProjectDir(), "testpassfile.tmp"); | ||||
| assert( "Passfile "+f+" not created", f.exists()); | |||||
| assertTrue( "Passfile "+f+" not created", f.exists()); | |||||
| assertEquals( | assertEquals( | ||||
| JAKARTA_URL+ EOL+ | JAKARTA_URL+ EOL+ | ||||
| @@ -138,7 +138,7 @@ public class ExecuteWatchdogTest extends TestCase { | |||||
| Process process = getProcess(TIME_OUT/2); | Process process = getProcess(TIME_OUT/2); | ||||
| watchdog.start(process); | watchdog.start(process); | ||||
| int retCode = waitForEnd(process); | int retCode = waitForEnd(process); | ||||
| assert("process should not have been killed", !watchdog.killedProcess()); | |||||
| assertTrue("process should not have been killed", !watchdog.killedProcess()); | |||||
| assertEquals(0, retCode); | assertEquals(0, retCode); | ||||
| } | } | ||||
| @@ -149,10 +149,10 @@ public class ExecuteWatchdogTest extends TestCase { | |||||
| watchdog.start(process); | watchdog.start(process); | ||||
| int retCode = process.waitFor(); | int retCode = process.waitFor(); | ||||
| long elapsed = System.currentTimeMillis() - now; | long elapsed = System.currentTimeMillis() - now; | ||||
| assert("process should have been killed", watchdog.killedProcess()); | |||||
| // assert("return code is invalid: " + retCode, retCode!=0); | |||||
| assert("elapse time is less than timeout value", elapsed > TIME_OUT); | |||||
| assert("elapse time is greater than run value", elapsed < TIME_OUT*2); | |||||
| assertTrue("process should have been killed", watchdog.killedProcess()); | |||||
| // assertTrue("return code is invalid: " + retCode, retCode!=0); | |||||
| assertTrue("elapse time is less than timeout value", elapsed > TIME_OUT); | |||||
| assertTrue("elapse time is greater than run value", elapsed < TIME_OUT*2); | |||||
| } | } | ||||
| // test a process that runs and failed | // test a process that runs and failed | ||||
| @@ -160,8 +160,8 @@ public class ExecuteWatchdogTest extends TestCase { | |||||
| Process process = getProcess(-1); // process should abort | Process process = getProcess(-1); // process should abort | ||||
| watchdog.start(process); | watchdog.start(process); | ||||
| int retCode = process.waitFor(); | int retCode = process.waitFor(); | ||||
| assert("process should not have been killed", !watchdog.killedProcess()); | |||||
| assert("return code is invalid: " + retCode, retCode!=0); | |||||
| assertTrue("process should not have been killed", !watchdog.killedProcess()); | |||||
| assertTrue("return code is invalid: " + retCode, retCode!=0); | |||||
| } | } | ||||
| public void testManualStop() throws Exception { | public void testManualStop() throws Exception { | ||||
| @@ -192,7 +192,7 @@ public class ExecuteWatchdogTest extends TestCase { | |||||
| // process should be dead and well finished | // process should be dead and well finished | ||||
| assertEquals(0, process.exitValue()); | assertEquals(0, process.exitValue()); | ||||
| assert("process should not have been killed", !watchdog.killedProcess()); | |||||
| assertTrue("process should not have been killed", !watchdog.killedProcess()); | |||||
| } | } | ||||
| public static class TimeProcess { | public static class TimeProcess { | ||||
| @@ -88,7 +88,7 @@ public class JarTest extends TaskdefsTest { | |||||
| public void test4() { | public void test4() { | ||||
| executeTarget("test4"); | executeTarget("test4"); | ||||
| File jarFile = new File(getProjectDir(), tempJar); | File jarFile = new File(getProjectDir(), tempJar); | ||||
| assert(jarFile.exists()); | |||||
| assertTrue(jarFile.exists()); | |||||
| jarModifiedDate = jarFile.lastModified(); | jarModifiedDate = jarFile.lastModified(); | ||||
| } | } | ||||
| @@ -78,7 +78,7 @@ public class SleepTest extends TaskdefsTest { | |||||
| executeTarget("test1"); | executeTarget("test1"); | ||||
| timer.stop(); | timer.stop(); | ||||
| if(TRACE) System.out.println(" test1 elapsed time="+timer.time()); | if(TRACE) System.out.println(" test1 elapsed time="+timer.time()); | ||||
| assert(timer.time()>=0); | |||||
| assertTrue(timer.time()>=0); | |||||
| } | } | ||||
| public void test2() { | public void test2() { | ||||
| @@ -86,7 +86,7 @@ public class SleepTest extends TaskdefsTest { | |||||
| executeTarget("test2"); | executeTarget("test2"); | ||||
| timer.stop(); | timer.stop(); | ||||
| if(TRACE) System.out.println(" test2 elapsed time="+timer.time()); | if(TRACE) System.out.println(" test2 elapsed time="+timer.time()); | ||||
| assert(timer.time()>=0); | |||||
| assertTrue(timer.time()>=0); | |||||
| } | } | ||||
| public void test3() { | public void test3() { | ||||
| @@ -94,7 +94,7 @@ public class SleepTest extends TaskdefsTest { | |||||
| executeTarget("test3"); | executeTarget("test3"); | ||||
| timer.stop(); | timer.stop(); | ||||
| if(TRACE) System.out.println(" test3 elapsed time="+timer.time()); | if(TRACE) System.out.println(" test3 elapsed time="+timer.time()); | ||||
| assert(timer.time()>=(2000-ERROR_RANGE)); | |||||
| assertTrue(timer.time()>=(2000-ERROR_RANGE)); | |||||
| } | } | ||||
| public void test4() { | public void test4() { | ||||
| @@ -102,7 +102,7 @@ public class SleepTest extends TaskdefsTest { | |||||
| executeTarget("test3"); | executeTarget("test3"); | ||||
| timer.stop(); | timer.stop(); | ||||
| if(TRACE) System.out.println(" test4 elapsed time="+timer.time()); | if(TRACE) System.out.println(" test4 elapsed time="+timer.time()); | ||||
| assert(timer.time()>=(2000-ERROR_RANGE) && timer.time()<60000); | |||||
| assertTrue(timer.time()>=(2000-ERROR_RANGE) && timer.time()<60000); | |||||
| } | } | ||||
| public void test5() { | public void test5() { | ||||
| @@ -115,7 +115,7 @@ public class SleepTest extends TaskdefsTest { | |||||
| executeTarget("test6"); | executeTarget("test6"); | ||||
| timer.stop(); | timer.stop(); | ||||
| if(TRACE) System.out.println(" test6 elapsed time="+timer.time()); | if(TRACE) System.out.println(" test6 elapsed time="+timer.time()); | ||||
| assert(timer.time()<2000); | |||||
| assertTrue(timer.time()<2000); | |||||
| } | } | ||||
| @@ -83,7 +83,7 @@ public class ANTLRTest extends TaskdefsTest { | |||||
| executeTarget("test3"); | executeTarget("test3"); | ||||
| File outputDirectory = new File(TASKDEFS_DIR + "antlr.tmp"); | File outputDirectory = new File(TASKDEFS_DIR + "antlr.tmp"); | ||||
| String[] calcFiles = outputDirectory.list(new CalcFileFilter()); | String[] calcFiles = outputDirectory.list(new CalcFileFilter()); | ||||
| assert(5 == calcFiles.length); | |||||
| assertEquals(5, calcFiles.length); | |||||
| } | } | ||||
| public void test4() { | public void test4() { | ||||
| @@ -93,7 +93,7 @@ public class CommandlineJavaTest extends TestCase { | |||||
| * here without using the same logic as applied in the class | * here without using the same logic as applied in the class | ||||
| * itself. | * itself. | ||||
| * | * | ||||
| * assert("no classpath", "java", s[0]); | |||||
| * assertTrue("no classpath", "java", s[0]); | |||||
| */ | */ | ||||
| assertEquals("no classpath", "-Djava.compiler=NONE", s[1]); | assertEquals("no classpath", "-Djava.compiler=NONE", s[1]); | ||||
| assertEquals("no classpath", "junit.textui.TestRunner", s[2]); | assertEquals("no classpath", "junit.textui.TestRunner", s[2]); | ||||
| @@ -112,9 +112,9 @@ public class CommandlineJavaTest extends TestCase { | |||||
| // assertEquals("with classpath", "java", s[0]); | // assertEquals("with classpath", "java", s[0]); | ||||
| assertEquals("with classpath", "-Djava.compiler=NONE", s[1]); | assertEquals("with classpath", "-Djava.compiler=NONE", s[1]); | ||||
| assertEquals("with classpath", "-classpath", s[2]); | assertEquals("with classpath", "-classpath", s[2]); | ||||
| assert("junit.jar contained", | |||||
| assertTrue("junit.jar contained", | |||||
| s[3].indexOf("junit.jar"+java.io.File.pathSeparator) >= 0); | s[3].indexOf("junit.jar"+java.io.File.pathSeparator) >= 0); | ||||
| assert("ant.jar contained", s[3].endsWith("ant.jar")); | |||||
| assertTrue("ant.jar contained", s[3].endsWith("ant.jar")); | |||||
| assertEquals("with classpath", "junit.textui.TestRunner", s[4]); | assertEquals("with classpath", "junit.textui.TestRunner", s[4]); | ||||
| assertEquals("with classpath", | assertEquals("with classpath", | ||||
| "org.apache.tools.ant.CommandlineJavaTest", s[5]); | "org.apache.tools.ant.CommandlineJavaTest", s[5]); | ||||
| @@ -76,14 +76,14 @@ public class EnumeratedAttributeTest extends TestCase { | |||||
| public void testContains() { | public void testContains() { | ||||
| EnumeratedAttribute t1 = new TestNormal(); | EnumeratedAttribute t1 = new TestNormal(); | ||||
| for (int i=0; i<expected.length; i++) { | for (int i=0; i<expected.length; i++) { | ||||
| assert(expected[i]+" is in TestNormal", | |||||
| assertTrue(expected[i]+" is in TestNormal", | |||||
| t1.containsValue(expected[i])); | t1.containsValue(expected[i])); | ||||
| assert(expected[i].toUpperCase()+" is in TestNormal", | |||||
| assertTrue(expected[i].toUpperCase()+" is in TestNormal", | |||||
| !t1.containsValue(expected[i].toUpperCase())); | !t1.containsValue(expected[i].toUpperCase())); | ||||
| } | } | ||||
| assert("TestNormal doesn\'t have \"d\" attribute", | |||||
| assertTrue("TestNormal doesn\'t have \"d\" attribute", | |||||
| !t1.containsValue("d")); | !t1.containsValue("d")); | ||||
| assert("TestNull doesn\'t have \"d\" attribute and doesn\'t die", | |||||
| assertTrue("TestNull doesn\'t have \"d\" attribute and doesn\'t die", | |||||
| !(new TestNull()).containsValue("d")); | !(new TestNull()).containsValue("d")); | ||||
| } | } | ||||
| @@ -170,7 +170,7 @@ public class MapperTest extends TestCase { | |||||
| m3.setFrom("*.java"); | m3.setFrom("*.java"); | ||||
| m3.setTo("*.class"); | m3.setTo("*.class"); | ||||
| FileNameMapper fmm = m1.getImplementation(); | FileNameMapper fmm = m1.getImplementation(); | ||||
| assert("should be glob", fmm instanceof GlobPatternMapper); | |||||
| assertTrue("should be glob", fmm instanceof GlobPatternMapper); | |||||
| String[] result = fmm.mapFileName("a.java"); | String[] result = fmm.mapFileName("a.java"); | ||||
| assertEquals("a.java should match", 1, result.length); | assertEquals("a.java should match", 1, result.length); | ||||
| assertEquals("a.class", result[0]); | assertEquals("a.class", result[0]); | ||||
| @@ -135,7 +135,7 @@ public class PathTest extends TestCase { | |||||
| l = p.list(); | l = p.list(); | ||||
| if (isUnixStyle) { | if (isUnixStyle) { | ||||
| assertEquals("no drives on Unix", 2, l.length); | assertEquals("no drives on Unix", 2, l.length); | ||||
| assert("c resolved relative to project\'s basedir", | |||||
| assertTrue("c resolved relative to project\'s basedir", | |||||
| l[0].endsWith("/c")); | l[0].endsWith("/c")); | ||||
| assertEquals("/test", l[1]); | assertEquals("/test", l[1]); | ||||
| } else if (isNetWare) { | } else if (isNetWare) { | ||||
| @@ -150,7 +150,7 @@ public class PathTest extends TestCase { | |||||
| l = p.list(); | l = p.list(); | ||||
| if (isUnixStyle) { | if (isUnixStyle) { | ||||
| assertEquals("no drives on Unix", 2, l.length); | assertEquals("no drives on Unix", 2, l.length); | ||||
| assert("c resolved relative to project\'s basedir", | |||||
| assertTrue("c resolved relative to project\'s basedir", | |||||
| l[0].endsWith("/c")); | l[0].endsWith("/c")); | ||||
| assertEquals("/test", l[1]); | assertEquals("/test", l[1]); | ||||
| } else if (isNetWare) { | } else if (isNetWare) { | ||||
| @@ -72,17 +72,17 @@ public class DOMElementWriterTest extends TestCase { | |||||
| } | } | ||||
| public void testIsReference() { | public void testIsReference() { | ||||
| assert("", w.isReference("")); | |||||
| assert(" ", w.isReference(" ")); | |||||
| assert(" ", w.isReference(" ")); | |||||
| assert("&#A0;", !w.isReference("&#A0;")); | |||||
| assert("20;", !w.isReference("20;")); | |||||
| assert("", !w.isReference("")); | |||||
| assert(""", w.isReference(""")); | |||||
| assert("'", w.isReference("'")); | |||||
| assert(">", w.isReference(">")); | |||||
| assert("<", w.isReference("<")); | |||||
| assert("&", w.isReference("&")); | |||||
| assertTrue("", w.isReference("")); | |||||
| assertTrue(" ", w.isReference(" ")); | |||||
| assertTrue(" ", w.isReference(" ")); | |||||
| assertTrue("&#A0;", !w.isReference("&#A0;")); | |||||
| assertTrue("20;", !w.isReference("20;")); | |||||
| assertTrue("", !w.isReference("")); | |||||
| assertTrue(""", w.isReference(""")); | |||||
| assertTrue("'", w.isReference("'")); | |||||
| assertTrue(">", w.isReference(">")); | |||||
| assertTrue("<", w.isReference("<")); | |||||
| assertTrue("&", w.isReference("&")); | |||||
| } | } | ||||
| public void testEncode() { | public void testEncode() { | ||||
| @@ -76,28 +76,28 @@ public abstract class RegexpMatcherTest extends TestCase { | |||||
| public void testMatches() { | public void testMatches() { | ||||
| RegexpMatcher reg = getImplementation(); | RegexpMatcher reg = getImplementation(); | ||||
| reg.setPattern("aaaa"); | reg.setPattern("aaaa"); | ||||
| assert("aaaa should match itself", reg.matches("aaaa")); | |||||
| assert("aaaa should match xaaaa", reg.matches("xaaaa")); | |||||
| assert("aaaa shouldn\'t match xaaa", !reg.matches("xaaa")); | |||||
| assertTrue("aaaa should match itself", reg.matches("aaaa")); | |||||
| assertTrue("aaaa should match xaaaa", reg.matches("xaaaa")); | |||||
| assertTrue("aaaa shouldn\'t match xaaa", !reg.matches("xaaa")); | |||||
| reg.setPattern("^aaaa"); | reg.setPattern("^aaaa"); | ||||
| assert("^aaaa shouldn\'t match xaaaa", !reg.matches("xaaaa")); | |||||
| assert("^aaaa should match aaaax", reg.matches("aaaax")); | |||||
| assertTrue("^aaaa shouldn\'t match xaaaa", !reg.matches("xaaaa")); | |||||
| assertTrue("^aaaa should match aaaax", reg.matches("aaaax")); | |||||
| reg.setPattern("aaaa$"); | reg.setPattern("aaaa$"); | ||||
| assert("aaaa$ shouldn\'t match aaaax", !reg.matches("aaaax")); | |||||
| assert("aaaa$ should match xaaaa", reg.matches("xaaaa")); | |||||
| assertTrue("aaaa$ shouldn\'t match aaaax", !reg.matches("aaaax")); | |||||
| assertTrue("aaaa$ should match xaaaa", reg.matches("xaaaa")); | |||||
| reg.setPattern("[0-9]+"); | reg.setPattern("[0-9]+"); | ||||
| assert("[0-9]+ should match 123", reg.matches("123")); | |||||
| assert("[0-9]+ should match 1", reg.matches("1")); | |||||
| assert("[0-9]+ shouldn\'t match \'\'", !reg.matches("")); | |||||
| assert("[0-9]+ shouldn\'t match a", !reg.matches("a")); | |||||
| assertTrue("[0-9]+ should match 123", reg.matches("123")); | |||||
| assertTrue("[0-9]+ should match 1", reg.matches("1")); | |||||
| assertTrue("[0-9]+ shouldn\'t match \'\'", !reg.matches("")); | |||||
| assertTrue("[0-9]+ shouldn\'t match a", !reg.matches("a")); | |||||
| reg.setPattern("[0-9]*"); | reg.setPattern("[0-9]*"); | ||||
| assert("[0-9]* should match 123", reg.matches("123")); | |||||
| assert("[0-9]* should match 1", reg.matches("1")); | |||||
| assert("[0-9]* should match \'\'", reg.matches("")); | |||||
| assert("[0-9]* should match a", reg.matches("a")); | |||||
| assertTrue("[0-9]* should match 123", reg.matches("123")); | |||||
| assertTrue("[0-9]* should match 1", reg.matches("1")); | |||||
| assertTrue("[0-9]* should match \'\'", reg.matches("")); | |||||
| assertTrue("[0-9]* should match a", reg.matches("a")); | |||||
| reg.setPattern("([0-9]+)=\\1"); | reg.setPattern("([0-9]+)=\\1"); | ||||
| assert("([0-9]+)=\\1 should match 1=1", reg.matches("1=1")); | |||||
| assert("([0-9]+)=\\1 shouldn\'t match 1=2", !reg.matches("1=2")); | |||||
| assertTrue("([0-9]+)=\\1 should match 1=1", reg.matches("1=1")); | |||||
| assertTrue("([0-9]+)=\\1 shouldn\'t match 1=2", !reg.matches("1=2")); | |||||
| } | } | ||||
| public void testGroups() { | public void testGroups() { | ||||
| @@ -126,8 +126,8 @@ public class AsiExtraFieldTest extends TestCase implements UnixStat { | |||||
| a.parseFromLocalFileData(data, 0, data.length); | a.parseFromLocalFileData(data, 0, data.length); | ||||
| assertEquals("length plain file", data.length, | assertEquals("length plain file", data.length, | ||||
| a.getLocalFileDataLength().getValue()); | a.getLocalFileDataLength().getValue()); | ||||
| assert("plain file, no link", !a.isLink()); | |||||
| assert("plain file, no dir", !a.isDirectory()); | |||||
| assertTrue("plain file, no link", !a.isLink()); | |||||
| assertTrue("plain file, no dir", !a.isDirectory()); | |||||
| assertEquals("mode plain file", FILE_FLAG | 0123, a.getMode()); | assertEquals("mode plain file", FILE_FLAG | 0123, a.getMode()); | ||||
| assertEquals("uid plain file", 5, a.getUserId()); | assertEquals("uid plain file", 5, a.getUserId()); | ||||
| assertEquals("gid plain file", 6, a.getGroupId()); | assertEquals("gid plain file", 6, a.getGroupId()); | ||||
| @@ -141,8 +141,8 @@ public class AsiExtraFieldTest extends TestCase implements UnixStat { | |||||
| a.parseFromLocalFileData(data, 0, data.length); | a.parseFromLocalFileData(data, 0, data.length); | ||||
| assertEquals("length link", data.length, | assertEquals("length link", data.length, | ||||
| a.getLocalFileDataLength().getValue()); | a.getLocalFileDataLength().getValue()); | ||||
| assert("link, is link", a.isLink()); | |||||
| assert("link, no dir", !a.isDirectory()); | |||||
| assertTrue("link, is link", a.isLink()); | |||||
| assertTrue("link, no dir", !a.isDirectory()); | |||||
| assertEquals("mode link", LINK_FLAG | 0123, a.getMode()); | assertEquals("mode link", LINK_FLAG | 0123, a.getMode()); | ||||
| assertEquals("uid link", 5, a.getUserId()); | assertEquals("uid link", 5, a.getUserId()); | ||||
| assertEquals("gid link", 6, a.getGroupId()); | assertEquals("gid link", 6, a.getGroupId()); | ||||
| @@ -156,8 +156,8 @@ public class AsiExtraFieldTest extends TestCase implements UnixStat { | |||||
| a.parseFromLocalFileData(data, 0, data.length); | a.parseFromLocalFileData(data, 0, data.length); | ||||
| assertEquals("length dir", data.length, | assertEquals("length dir", data.length, | ||||
| a.getLocalFileDataLength().getValue()); | a.getLocalFileDataLength().getValue()); | ||||
| assert("dir, no link", !a.isLink()); | |||||
| assert("dir, is dir", a.isDirectory()); | |||||
| assertTrue("dir, no link", !a.isLink()); | |||||
| assertTrue("dir, is dir", a.isDirectory()); | |||||
| assertEquals("mode dir", DIR_FLAG | 0123, a.getMode()); | assertEquals("mode dir", DIR_FLAG | 0123, a.getMode()); | ||||
| assertEquals("uid dir", 5, a.getUserId()); | assertEquals("uid dir", 5, a.getUserId()); | ||||
| assertEquals("gid dir", 6, a.getGroupId()); | assertEquals("gid dir", 6, a.getGroupId()); | ||||
| @@ -101,10 +101,10 @@ public class ExtraFieldUtilsTest extends TestCase implements UnixStat { | |||||
| public void testParse() throws Exception { | public void testParse() throws Exception { | ||||
| ZipExtraField[] ze = ExtraFieldUtils.parse(data); | ZipExtraField[] ze = ExtraFieldUtils.parse(data); | ||||
| assertEquals("number of fields", 2, ze.length); | assertEquals("number of fields", 2, ze.length); | ||||
| assert("type field 1", ze[0] instanceof AsiExtraField); | |||||
| assertTrue("type field 1", ze[0] instanceof AsiExtraField); | |||||
| assertEquals("mode field 1", 040755, | assertEquals("mode field 1", 040755, | ||||
| ((AsiExtraField) ze[0]).getMode()); | ((AsiExtraField) ze[0]).getMode()); | ||||
| assert("type field 2", ze[1] instanceof UnrecognizedExtraField); | |||||
| assertTrue("type field 2", ze[1] instanceof UnrecognizedExtraField); | |||||
| assertEquals("data length field 2", 0, | assertEquals("data length field 2", 0, | ||||
| ze[1].getLocalFileDataLength().getValue()); | ze[1].getLocalFileDataLength().getValue()); | ||||
| @@ -97,15 +97,15 @@ public class ZipLongTest extends TestCase { | |||||
| ZipLong zl2 = new ZipLong(0x12345678); | ZipLong zl2 = new ZipLong(0x12345678); | ||||
| ZipLong zl3 = new ZipLong(0x87654321); | ZipLong zl3 = new ZipLong(0x87654321); | ||||
| assert("reflexive", zl.equals(zl)); | |||||
| assertTrue("reflexive", zl.equals(zl)); | |||||
| assert("works", zl.equals(zl2)); | |||||
| assert("works, part two", !zl.equals(zl3)); | |||||
| assertTrue("works", zl.equals(zl2)); | |||||
| assertTrue("works, part two", !zl.equals(zl3)); | |||||
| assert("symmetric", zl2.equals(zl)); | |||||
| assertTrue("symmetric", zl2.equals(zl)); | |||||
| assert("null handling", !zl.equals(null)); | |||||
| assert("non ZipLong handling", !zl.equals(new Integer(0x1234))); | |||||
| assertTrue("null handling", !zl.equals(null)); | |||||
| assertTrue("non ZipLong handling", !zl.equals(new Integer(0x1234))); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -95,15 +95,15 @@ public class ZipShortTest extends TestCase { | |||||
| ZipShort zs2 = new ZipShort(0x1234); | ZipShort zs2 = new ZipShort(0x1234); | ||||
| ZipShort zs3 = new ZipShort(0x5678); | ZipShort zs3 = new ZipShort(0x5678); | ||||
| assert("reflexive", zs.equals(zs)); | |||||
| assertTrue("reflexive", zs.equals(zs)); | |||||
| assert("works", zs.equals(zs2)); | |||||
| assert("works, part two", !zs.equals(zs3)); | |||||
| assertTrue("works", zs.equals(zs2)); | |||||
| assertTrue("works, part two", !zs.equals(zs3)); | |||||
| assert("symmetric", zs2.equals(zs)); | |||||
| assertTrue("symmetric", zs2.equals(zs)); | |||||
| assert("null handling", !zs.equals(null)); | |||||
| assert("non ZipShort handling", !zs.equals(new Integer(0x1234))); | |||||
| assertTrue("null handling", !zs.equals(null)); | |||||
| assertTrue("non ZipShort handling", !zs.equals(new Integer(0x1234))); | |||||
| } | } | ||||
| /** | /** | ||||