Sharon whipple wrote:create stubs mocks and context xml for each test? that's really a overhead,
Why not to load the application context xml, and test the services/dao with the same configuration of the prod?
Shaorn
Not exactly the way you put it. The Unit Tests xml would be just the configuration that is different in that environment.
As far as the Application Context, because you have all your services and dao/repositories defined in an xml in the WEB-INF directory, you just tied that configuration of beans to the web environment only. So if you wanted the same somewhere else, you would have to repeat yourself. I would recommend creating an application-config.xml in your java code classpath, and in your WEB-INF create a file called applicationContext.xml and import that application-config.xml
And in your unit test, you can create a test-infrastructure.xml config file that imports the application-config.xml. So that the stuff that is shared across environments is in a location all environments can get to.
Mark