我尝试创建一个模拟:
final CofmanServiceNet cofmanService = mock(CofmanServiceNet.class);
这个班级:
public class CofmanServiceNet implements CofmanService {
private CofmanClient cofmanClient;
private Logger logger = LoggingUtils.getLogger();
private JsonUtility jsonUtility = new JsonUtility();
...
}
但是,当我调用真正的方法时,我看到logger
成员未初始化:
when(cofmanService.updatePartnerFromCurrentProto(anyObject(), anyObject())).thenCallRealMethod();