I\'m pretty new to Mockito and have some trouble with clean up.
I used to use JMock2 for unit tests. As far as I know, JMock2 preserves the expectations and other mo
Instead of injecting the placeOrderService
object, you should probably just let Mockito initialize it as a @Mock
before each test, via something like this:
@Mock private PlaceOrderService placeOrderService;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
}
As recommended in the Javadoc here: http://docs.mockito.googlecode.com/hg/latest/org/mockito/MockitoAnnotations.html
You can even put the @Before
method in a superclass and just extend it for each test case class that uses @Mock
objects.