This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

(maven, junit) Read files from WEB-INF and test it

 
Juri Glass
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17628
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic