我不知道为什么,但我总是这样写我的 JMock 测试:
@Test
public void testMyThing() throws Exception {
mockery.checking(new Expectations() {{
oneOf(mockObj).foo();
}});
testObj.bar(); // calls mockObj.foo()
mockery.assertIsSatisfied();
}
但是当有很多测试时,是否更好地进行assertIsSatisfied
拆卸?
@After
public void tearDown() throws Exception {
mockery.assertIsSatisfied();
}