On Sun, 2008-02-24 at 14:43 +0100, tarjei wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, I got a test that needs to read a file in src/test/resources. How > should I write the test to get the information about the relative path > to that file, either using TestNG or just plain Junit?
It's best to avoid files at all. Where possible, I suggest using Class.getResourceAsStream(...) to access the data you want. The stuff in src/test/resources is on the classpath. If you really need a File object, then try URL url = Class.getResource(...); File f = url.tgetFile() Regards, Simon --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
