I don't know why, but I have always written my JMock tests like this:
@Test
public void testMyThing() throws Exception {
mockery.checking(new Expectations() {{
oneOf(mockObj).foo();
}});
testObj.bar(); // calls mockObj.foo()
mockery.assertIsSatisfied();
}
But when there are many tests, is it better to move assertIsSatisfied
to the tear-down?
@After
public void tearDown() throws Exception {
mockery.assertIsSatisfied();
}