Mockito 错误 "The system cannot find the path specified"
Mockito error "The system cannot find the path specified"
有人可以帮助我如何模拟这个调用吗?
实际代码
final ServicesLocal servicesBean = new WSDelegate().getServiceLocal();
这是我的模拟代码
mockDelegate = mock(PortalDelegate.class);
PowerMockito.whenNew(PortalDelegate.class).withAnyArguments().thenReturn(mockPortalDelegate);
您还必须为方法调用添加 when
。
ServicesLocal mockServicesLocal = mock(ServicesLocal.class);
when(mockDelegate.getServiceLocal()).thenReturn(mockServicesLocal);
有人可以帮助我如何模拟这个调用吗?
实际代码
final ServicesLocal servicesBean = new WSDelegate().getServiceLocal();
这是我的模拟代码
mockDelegate = mock(PortalDelegate.class);
PowerMockito.whenNew(PortalDelegate.class).withAnyArguments().thenReturn(mockPortalDelegate);
您还必须为方法调用添加 when
。
ServicesLocal mockServicesLocal = mock(ServicesLocal.class);
when(mockDelegate.getServiceLocal()).thenReturn(mockServicesLocal);