含有返回值:
when (对象.方法 (参数)).thenReturn (方法的返回值);
不含返回值:
Mockito.doAnswer(new Answer<Object>() {
public Object answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
return "called with arguments: " + args;
}
}).when(对象).方法名();