Stephen More created DELTASPIKE-1236:
----------------------------------------

             Summary: unit testing a servlet that uses injection
                 Key: DELTASPIKE-1236
                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-1236
             Project: DeltaSpike
          Issue Type: Improvement
    Affects Versions: 1.7.2
         Environment: Tomcat
            Reporter: Stephen More


I have been using org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner to 
test JSF backing beans and everything seems to be working well.

At this point I am struggling how to test a plain old servlet that uses 
injection, are there any examples anywhere ?

The current - non working test code can be found here: 
https://github.com/mores/maven-examples/tree/master/prime-deltaspike

Servlet works as expected when deployed - output is survey says: 3.96 
(https://github.com/mores/maven-examples/blob/master/prime-deltaspike/src/main/java/org/test/MyServlet.java)

But when trying to run the test, windowContext appears to be null. ( 
https://github.com/mores/maven-examples/blob/master/prime-deltaspike/src/test/java/org/test/MyServletTest.java
 )



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to