powermock

    1熱度

    1回答

    我有以下簡單的類: import javax.net.ssl.SSLContext; public class AClass { public void someMethod() throws Exception { SSLContext context = SSLContext.getInstance("SSL"); context.init(null, nul

    1熱度

    1回答

    Powermock不能在Java 1.5上運行嗎?我得到以下異常 cannot access org.powermock.core.classloader.annotations.PrepareForTest ...lib\powermock-mockito-1.6.2-full.jar (org/powermock/core/classloader/annotations/PrepareF

    0熱度

    1回答

    我正在編寫和與第三方Java SDK接口的應用程序。我目前正在使用Mockito和PowerMock編寫單元測試。我遇到了一個嘲笑sdk提供的類的問題。僞類看起來是這樣的: class A{ public static A getInstance() { ... } public A(){ ... } } 我試圖模擬類B,其電話有

    0熱度

    1回答

    public class DownloadBoxHelper extends WCMUsePojo { private static final Logger log = LoggerFactory.getLogger(DownloadBoxHelper.class); private ArrayList<Map<String, String>> downloadList; private

    0熱度

    1回答

    我需要卸載一個靜態方法&在類構造函數中調用真正的方法,因爲這樣會連接到數據庫。當我說@RunWith(PowerMockRunner.class)時,現在使用powermock它不允許我調用真正的方法。這在mockito中是可行的,但我需要使用powermock,因爲我也需要模擬其他靜態方法。 公共TestESMock()拋出的ConfigurationException { DatabaseIm

    0熱度

    1回答

    下面的代碼: public final class APIClient { private static Identity identity = createIdentity(); private static Identity createIdentity() { CredentialsProvider provider = new CredentialsPro

    2熱度

    1回答

    我想通過使用PowerMockRunner模擬java.security.cert.X509Certificate,javax.security.auth.x500.X500Principal來編寫測試用例。當我嘗試導入X500Principal IDE的類時,顯示2個導入選項(javax.security.auth.x500.X500Principal,com.sun.security.auth

    1熱度

    2回答

    PowerMockito.mockStatic(HConnectionManager.class); when(HConnectionManager.createConnection(configuration)).thenReturn(hConnection) 什麼是嘲笑HBase的相關的配置文件的方式?當我得到: java.lang.ExceptionInInitializerError

    6熱度

    4回答

    給定科特林單對象,並調用它的方法 object SomeObject { fun someFun() {} } fun callerFun() { SomeObject.someFun() } 有沒有一種方法來模擬來電SomeObject.someFun()一個有趣?

    1熱度

    2回答

    我想使用PowerMockito創建final類的間諜,但我不斷收到以下錯誤,即使我正在使用PowerMockito的spy()方法代替Mockito的: java.lang.IllegalArgumentException異常:不能繼承final類類com.whoever.WidgetUploadClient 我的測試用例看起來是這樣的: ... import static org.power