KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Here's my question: I have several web services classes to test that all inherit their methods from a generic service. Rather than write a unit test for each, I figure I can break the test suite down by functional areas (i.e. three groups of test methods, each relying on a different underlying DAO method call). What I propose to do is: @Mock StateDAO mockedStateDao; @Mock CountyDAO mockedCountyDao; @Mock VisitorDAO mockedVisitorDao; then call: @InjectMocks CountyServiceImpl<County> countyService = new CountyServiceImpl<County>(); @InjectMocks StateServiceImpl<State> stateService = new StateServiceImpl<State>(); @InjectMocks VisitorServiceImpl<Visitor> visitorService = new VisitorServiceImpl<Visitor>(); How can I be sure that each mockedDAO will be injected into the correct service? Would it be easier to autowire all three (rather than use @InjectMocks)? I'm using Spring, Hibernate, and Mockito...
Tags (comma-separated)
Save Edits
Cancel