Mocking my custom dependencies with Spring

Posted by Brabster on Stack Overflow See other posts from Stack Overflow or by Brabster
Published on 2011-01-10T12:15:28Z Indexed on 2011/01/10 12:53 UTC
Read the original article Hit count: 230

Filed under:
|
|

Is is possible to declare mocks using some mocking framework for my own classes declaratively with Spring? I know there are some standard mocks available in Spring, but I'd like to be able to mock out my own classes declaratively too.

Just to check I'm not going about this the wrong way: the idea is to have a pair of JUnit test and Spring config for each integration test I want to do, mocking everything except the specific integration aspect I'm testing (say I had a dependency on two different data services, test one at a time) and minimising the amount of repeated Java code specifying the mocks.

© Stack Overflow or respective owner

Related posts about java

Related posts about spring