【发布时间】:2017-01-26 07:57:27
【问题描述】:
如果我有一个对象 MyObject,我想在调用该对象的某个方法时返回一些值。例如这样的:
doReturn(someValue).when(Mockito.any(MyObject.class)).getSomeValue();
我试过这样,但它不起作用:
org.mockito.exceptions.misusing.NullInsteadOfMockException:
Argument passed to when() is null!
【问题讨论】:
标签: java unit-testing spring-boot junit mockito