A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
Ant, Maven and Other Build Tools
(maven, junit) Read files from WEB-INF and test it
Joined: Jul 01, 2009
Sep 22, 2009 03:14:40
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).
I can do:
ServletContext context = getServletContext(); InputStream in = context.getResourceAsStream("WEB-INF/some.file");
that with a
How to refer to the files in WEB-INF in the JUnit tests? How do I set the context?
project has this structure (shortened):
- src - main - java - webapp - WEB-INF - test
Joined: Jun 25, 2001
Sep 22, 2009 04:38:22
a webapp context in jUnit. For that you either need to be running in a
container or something that simulates one.
You might want to look at Cactus (
Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: (maven, junit) Read files from WEB-INF and test it
project structure for maven 2
JUnit test for class dependent on being JAR'ed
mavn and specific jars
"Failed to load ApplicationContext" exception when trying to run JUnit Spring test
Struts 2 tutorial errors
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014