| Author |
(maven, junit) Read files from WEB-INF and test it
|
Juri Glass
Greenhorn
Joined: Jul 01, 2009
Posts: 6
|
|
Hi
I have a maven2 project which builds me a war file to run in a glassfish. Now I want to read from a file located in WEB-INF (can be moved if necessary).
In a servlet I can do:
How to test that with a JUnit 4.7 testcase?
How to refer to the files in WEB-INF in the JUnit tests? How do I set the context?
The maven project has this structure (shortened):
Best Juri
EDIT: Typo
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14491
|
|
You don't have a webapp context in jUnit. For that you either need to be running in a J2EE container or something that simulates one.
You might want to look at Cactus (http://jakarta.apache.org/cactus/).
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
 |
|
|
subject: (maven, junit) Read files from WEB-INF and test it
|
|
|