I was attempting to write a JUnit test for my DAO classes without having to run tru struts 2. The ones I attempted to write failed because the session object is NULL. Is it possible to write a Junit text with the plug-in? I havent seen any examples for Junit test cases. Please provide me with some guidance, Thanks in advance.
Ronaldo.
- User.java 990
- UserDAO.java 3.64KB
- TeamWorkerDAO.java 1.94KB
- TestUsersDAO.java 3.04KB
Comment #1
Posted on Sep 16, 2010 by Grumpy RabbitThis plugin uses Struts2 Interceptors for Session injection. So you cannot use pure JUnit test cases. Use Struts2 Junit Plugin.
Although, you can change your "setUp" method. Inject, by reflection or by "setter", the session object in your DAO object.
Status: Invalid
Labels:
Type-Defect
Priority-Medium