在powermockit中存根链接方法



我需要在powermockit中存根以下调用。

appAcceptedDoc.getAppointmentAccepted().getRequestResponse().getRequestersID().getStringValue()

我知道这可以在Mockito中使用returns_deep_stub作为mock调用时的附加参数来完成,但是如何使用PowerMockito/但似乎不接受与Mockito相同的参数。

AppointmentAcceptedDocument appAcceptedDoc = Mockito.mock(AppointmentAcceptedDocument.class, RETURNS_DEEP_STUBS); - Possible
AppointmentAcceptedDocument appAcceptedDoc = PowerMockito.mock(AppointmentAcceptedDocument.class, <?RETURNS_DEEP_STUBS?>); - Not possible

实际上您可以像使用Mockito一样使用powermockito

AppointmentAcceptedDocument appAcceptedDoc = PowerMockito.mock(AppointmentAcceptedDocument.class,  Mockito.RETURNS_DEEP_STUBS);

希望它能帮助到别人!

相关内容

  • 没有找到相关文章

最新更新