I am suppose to write unittesting code for my BO (business) layer by mocking DAO layer. I am using Java 1.4 and Spring 2.5 combination and need to strictly use this combination only.
I have tried to use the JMock API for this and i could inject the Mock DAO objects into the Business objects manually.
But i thought that it is a dirty way to inject mock objects. The difficult thing i could face using JMock is in setting up the mock data and injecting the mock objects manually.
As i am already using Spring framework for my application, i thought of making use of Spring for unit testing and automatically injecting DAO mock objects into BO objects while unit-testing.
Is there a way to define mock objects, setting expectations for mock objects, maintaining test data (kind of binding) using spring specifically using Spring configuration files. (in a configurable way)
Hope i am clear on my requirement. Thanks in advance for your time and attention.