Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

4. return Unit的,要写成doReturn/doAnswer().when(mock/spy).method()形式,即先return/answer再when,注意when的参数是mock/spy对象而不是方法的返回值

5. Mock suspend function, 参考 https://stackoverflow.com/questions/53098975/mocked-suspend-function-returns-null-in-mockito

 

示例代码