0
我有問題與嘲諷oracles ArrayDescriptor。下面是一個代碼示例: 讓說,我有方法是這樣的PowerMock和嘲諷oracle ArrayDescriptor
public void doSomething(){
//some code here
ArrayDescriptor arrayDescriptor = ArrayDescriptor.createDescriptor("TEST", connection);
//some more code
}
我應該怎樣嘲笑那arrayDescriptor一部分? 我想是這樣的:
PowerMock.mockStatic(ArrayDescriptor.class);
//connection is mocked
ArrayDescriptor arrayDescriptor = Mockito.mock(ArrayDescriptor.class);
//connection is also mocked
Mockito.when(ArrayDescriptor.createDescriptor("TEST", connection).thenReturn(arrayDescriptor);
但是,這並不工作,拋出某種NullPointerException異常有關SQLName,我試圖嘲弄SQLName,但並沒有幫助。
希望有人能幫助:)