Hi,
I would like to unit test my struts actions (that are currently spring-managed using ContextLoaderPlugin and DelegatingActionProxy) with strutstestcase and easymock.
I can use StrutsTestCase only for integration tests at the moment, because the real dependencies, as configured in applicationContext.xml are injected into my actions. I want my Easymock objects to be used by the actions instead.
Since struts actions are singletons, is there not a way to access the instances somehow, so I can manually inject my mocks in the testcase?
If that's not possible, what would you think of making the dependencies of my actions static? So I could use MyAction.setBlaService(blaMock); in my tests.
Would this have any drawbacks?


Reply With Quote