I assume you're actually talking about stubbing rather then mocking. Mock
frameworks belong more in unit testing then in integration testing.
If you are in fact talking about stubs then Ilja is right, just use a
different applicationContext to inject the stubbed version of your
validation service.
Hi Liam,
I recommend you read up on the Spring TestContext framework. (See the
relevent section in your Spring Reference)
Basically you will have to:
1) create a second applicationContext which only contains your stubbed
version of the service. (With the same beanname as the real service)
2) Add the following annotations to your integration test (If it uses the
TestContext framework)
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"/applicationContext.xml",
"/applicationContext-test.xml"})
This way your test will used the stubbed version and your normal code will
use the real version. If you were on the other hand talking about unit tests
and mock objects then none of the above applies. :o)
Kind regards,
Stijn