ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 543] New - NullPointerException in junit task
Date Wed, 07 Feb 2001 18:34:30 GMT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=543

*** shadow/543	Wed Feb  7 10:34:30 2001
--- shadow/543.tmp.1098	Wed Feb  7 10:34:30 2001
***************
*** 0 ****
--- 1,94 ----
+ +============================================================================+
+ | NullPointerException in junit task                                         |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 543                         Product: Ant                     |
+ |       Status: NEW                         Version: 1.3 Beta 1              |
+ |   Resolution:                            Platform: PC                      |
+ |     Severity: Normal                   OS/Version: Windows NT/2K           |
+ |     Priority:                           Component: Optional Tasks          |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: ant-dev@jakarta.apache.org                                   |
+ |  Reported By: timurz@playlink.com                                          |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ Using: ant 1.3 beta 1, junit 3.5, jdk 1.3
+ 
+ Summary: forked junit task throws a NullPointerException for a simple test
+ if you don't specify a classpath element. At the same time forked java task
+ using junit.textui.TestRunner works fine.
+ 
+ build.xml:
+ ========================================
+ <project name="HelloTest" default="test" basedir="." >
+ 
+     <property name="src.dir" value="src" />
+     <property name="out.dir" value="out" />
+     <property name="test.name" value="HelloTest" />
+ 
+     <target name="prepare" >
+         <mkdir dir="${out.dir}" />
+     </target>
+ 
+     <target name="compile" depends="prepare" >
+         <javac srcdir="${src.dir}"
+                destdir="${out.dir}"
+         />
+     </target>
+ 
+     <target name="test" depends="compile" >
+         <java classname="junit.textui.TestRunner"
+               fork="true"
+               dir="${out.dir}" >
+               <arg line="${test.name}" />
+         </java>
+         <junit fork="true"
+                dir="${out.dir}">
+                <test name="${test.name}" />
+         </junit>
+     </target>
+ 
+ </project>
+ ========================================
+ 
+ src/HelloTest.java:
+ ========================================
+ import junit.framework.TestCase;
+ 
+ public class HelloTest extends TestCase {
+ 
+     public HelloTest(String name) {
+         super(name);
+     }
+ 
+     public void test()  {
+     }
+ 
+ }
+ ========================================
+ 
+ output:
+ ========================================
+ test:
+      [java] .
+      [java] Time: 0
+      [java]
+      [java] OK (1 tests)
+      [java]
+ 
+ BUILD FAILED
+ 
+ java.lang.NullPointerException
+         at org.apache.tools.ant.types.CommandlineJava.clone
+ (CommandlineJava.java:242)
+         at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute
+ (JUnitTask.java:272)
+         at org.apache.tools.ant.Target.execute(Target.java:153)
+         at org.apache.tools.ant.Project.runTarget(Project.java:898)
+         at org.apache.tools.ant.Project.executeTarget(Project.java:536)
+         at org.apache.tools.ant.Project.executeTargets(Project.java:510)
+         at org.apache.tools.ant.Main.runBuild(Main.java:421)
+         at org.apache.tools.ant.Main.main(Main.java:149)
+ ========================================

Mime
View raw message