getPackage() returning null when my JUnit test is run from Ant
Posted
by philharvey
on Stack Overflow
See other posts from Stack Overflow
or by philharvey
Published on 2010-03-22T14:22:59Z
Indexed on
2010/03/22
14:41 UTC
Read the original article
Hit count: 290
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
© Stack Overflow or respective owner