I'm testing a Struts-Spring-Hibernate web application using JUnit. One of my methods that I'm testing takes a DynaActionForm (from the action class that calls it) as a parameter. Problem is that inside of my test I have no access to any of the parameters that are passed to this action class, and therefore cannot just pass my method the ActionForm object. Is there a way to use either the action path or the form-bean name as a string in my JAVA test in order to retrieve said form from my struts-config.xml file?
Passing a Struts ActionForm to a Business Logic or Model class is considered bad form. It breaks the MVC model by making your model class dependent on a specific view object (The struts ActionForm). What you're encountering right now is a good illustration of this: You're unable to test your Model classes without bringing the View Layer (Struts) into the picture.
It's better to develop objects that follow the "Transfer Object" or DTO pattern to shuttle information between your model classes and Struts. [ August 09, 2006: Message edited by: Merrill Higginson ]