2013-05-14 60 views
1

我需要在PowerMockito中調用以下存根。在PowerMockito中調用鏈接方法

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

我知道這是可以使用RETURNS_DEEP_STUBS在模擬時調用addional參數進行的Mockito做,但怎麼可以這樣使用PowerMockito做/,但似乎不接受作爲做的Mockito此相同的精氨酸。

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

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

回答

1

居然發現你能做到這一點powermockito,你只需用的Mockito

做下面的工作

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

希望它可以幫助別人!