我嘗試使用easyMock在我的對象中測試方法。 我做這樣的事情:如何使用EasyMock測試模擬方法
MyObject myObject = createMock(MyObject.class);
expect(myObject.someMethod()).andReturn(someReturn);
replay(myObject);
myObject.methodIwantToTest(); // here assertion or sth like this
verify(myObject);
這樣的代碼是拋出一個異常methodIwantToTest預計不會。如何測試這種方法?