getPackage() returning null when my JUnit test is run from Ant
- by philharvey
I'm having problems running a JUnit test.
It runs fine in Eclipse, but now I'm trying to run it from the command-line using Ant. The problem is that the following code is returning null: getClass().getPackage().
I'm running my JUnit test like so:
<junit fork="no" printsummary="yes" haltonfailure="no">
<classpath refid="junit.classpath" />
<batchtest fork="yes" todir="${reports.junit}">
<fileset dir="${junit.classdir}">
<include name="**/FileHttpServerTest.class" />
<exclude name="**/*$*" />
</fileset>
</batchtest>
<formatter type="xml" />
...
I Googled for this sort of error, and found a number of references to classloader misbehaviour. But I've found nothing gave me enough information to solve my problem.
I really need getClass().getPackage() to not return null. Can anyone help me?
Thanks,
Phil