On Sat, 2004-07-10 at 13:08, Omair-Inam Abdul-Matin wrote:
> I've tried the following and my unit tests still fail because the
> working directory seems to be the directory of the master project.
There is no way to reliably set the working directory in Java. To make
your tests reactor-able you must reference resources using the "basedir"
system property that is made available in tests by the junit plugin.
So the general pattern is:
public class MyTest extends TestCase
{
private String basedir;
protected void setUp()
{
basedir = System.getProperty( "basedir" );
}
public void testThatUsesAResourceFromTheFileSystem()
{
File resource = new File( basedir, "src/test/resources/MyTestResource.txt" );
// do you stuff with the file system resource.
}
}
--
jvz.
Jason van Zyl
[EMAIL PROTECTED]
http://maven.apache.org
happiness is like a butterfly: the more you chase it, the more it will
elude you, but if you turn your attention to other things, it will come
and sit softly on your shoulder ...
-- Thoreau
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]