0

In my specific test case, I need to over-ride the dependencies of my test case to inject more dependencies like servlet request and response.

It is not possible to mock these as my API requires an actual servlet container to compile and run JSP's.

How can I get a handle to the test instance using JUnit 4?

I have tried over-riding createTest() in BlockJUnit4Runner (which works), but then the same behavior cannot be extended to Parameterized tests, because the runner used by such tests are internal and not visible in the hierarchy.

Neel
  • 2,100
  • 5
  • 24
  • 47
  • Can you post an example test? – Garrett Hall Jun 13 '12 at 17:10
  • 1
    Have you looked at JUnitEE? See http://stackoverflow.com/questions/6390056/ive-inherited-a-jsp-java-servlet-web-app-can-i-junit-test-this-in-tomcat-to/6390794#6390794 – Olaf Jun 13 '12 at 19:37
  • @Olaf: I am bound to use JUnit - not possible to migrate to a different framework at this point. – Neel Oct 02 '12 at 22:10

0 Answers0