【发布时间】:2019-10-31 06:29:21
【问题描述】:
抛出错误目标调用异常。
public class A{
public method_name(){
int[] selections = grid.getSelectedIndices(); // Facing issue here...!
// Problem occur above line.
}
}
public class A_test{
Grid grid = EasyMock.createNicemock(Grid.class);
EasyMock.expect(grid.getSelectedIndices().andReturn(EasyMock.arEq(new int[] {1})));
EasyMock.replay(grid);
// I able to invoke method with the help of reflection
// method.invoke();
}
问题:我无法期待“getSelectedIndices()”。 在某些更改中,它给了我 0 个匹配器和 1 个报告的错误。因为无法匹配模拟对象和原始值
【问题讨论】:
标签: java unit-testing reflection easymock