15

I've been experimenting the Mockito equivalent of the

EasyMock.expect(someMethod()).andReturn(someMockObject).times(n);

but I can't figure it out.

A little help on this, please?

Thanks in advance.

4

1 回答 1

30
when(myObject.someMethod()).thenReturn(someMockObject);
// run test
verify(myObject, times(n)).someMethod();

有关更多转换示例,请参阅文档

于 2013-01-18T04:05:57.187 回答