ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephane Bailliez" <sbaill...@apache.org>
Subject Re: cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/junit JUnitClassLoaderTest.java
Date Wed, 20 Feb 2002 08:16:25 GMT
----- Original Message -----
From: "Stefan Bodewig" <bodewig@apache.org>


> On 19 Feb 2002, <sbailliez@apache.org> wrote:
>
> >   JUnitClassLoaderTest.java
>
> fails in GUMP.

> I think this is because getClass().getClassloader() is the system
> classloader, not the AntClassLoader.

sh*, that's right.

> Hmm, let me see, yes.  If I add build/testcases to my system
> classpath, the test fails.
>
> I'm going to disable it in that case, but we need to fix the test
> itself.  Any idea how we could make a reasonable testcase for the case
> where the testclass itself can be loaded via the system classloader?

Something like this
(sorry, from memory so some methods might not exists, I'm close to leave,
will be back in a couple of hours)

ClassLoader cl = null;
if (ClassLoader.getSystemResourceAsStream(testclass) != null){
    cl = ClassLoader.getSystemClassLoader();
} else {
    cl = getClass().getClassLoader();
}
assertSame(context, cl);



--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message