我正在尝试一个使用EasyMock的非常简单的例子,但是我根本无法构建它。我有以下的测试案例:在非常简单的例子中使用EasyMock.expect()编译错误?
@Test
public void testSomething()
{
SomeInterface mock = EasyMock.createMock(SomeInterface.class);
SomeBase expected = new DerivesFromSomeBase();
EasyMock.expect(mock.send(expected));
}
但是我得到的EasyMock.expect(...
线以下错误:
The method expect(T) in the type EasyMock is not applicable for the arguments (void)
有人可以点我在正确的方向?我完全失去了。
你的例子不编译。 'IAnswer'是一个通用的,需要一个模板。如果我使用'IAnswer
@bjarkef你是对的,它应该是'EasyMock.getCurrentArguments()'。我有一个静态导入,所以我没有注意到它缺少。 – Jasper