[ https://issues.apache.org/jira/browse/DELTASPIKE-1236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15892253#comment-15892253 ]
Stephen More commented on DELTASPIKE-1236: ------------------------------------------ [~johndament], this makes alot more sense than your post on the mailing list. I have updated my maven-example so that it now works. I have been using @InjectMocks without issue up till this point. I plan to remove @InjectMocks and utilize MockManager where needed. -Thanks > 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)