You should store your files under src/test/resources and load your files using getResourceAsStream
Regards Jeff MAURY On Tue, May 5, 2009 at 11:37 PM, Pete Siemsen <[email protected]> wrote: > This is a basic question about how to run Java unit tests that require file > names. > > I use maven to develop a program that reads an input file names from the > command line. It's working fine, but now I want to share the code with > someone else. The test programs live in ../src/test/java, and the test data > lives in ../src/test/data. Until now, I've used fully-qualified paths > hard-coded into my test programs, like > /Users/siemsen/TranslateCIM/src/test/data/cim/testArrayTypeOnNonArray/testATONA.mof. > > If I tar up my development directory and give it to someone else, the > fully-qualified paths obviously don't work. I want to make the paths > relative somehow. The program reads an input file that may contain > "include" statements that cause the program to open other files relative to > the first input file. It seems to my newbie eyes that using resources and > getResourceAsStream won't allow me to open subfiles. > > What I think I want is a runtime environment variable or something that > tells me the path to the maven development directory. > > Any suggestion would be appreciated. > > -- Pete > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- La mélancolie c’est communiste Tout le monde y a droit de temps en temps La mélancolie n’est pas capitaliste C’est même gratuit pour les perdants La mélancolie c’est pacifiste On ne lui rentre jamais dedans La mélancolie oh tu sais ça existe Elle se prend même avec des gants La mélancolie c’est pour les syndicalistes Il faut juste sa carte de permanent Miossec (2006) http://www.jeffmaury.com http://riadiscuss.jeffmaury.com http://www.lastfm.fr/listen/user/jeffmaury/personal
