jmockit

    6熱度

    3回答

    我有一個類如下: class ClassA { private static File myDir; // myDir is created at some stage private static String findFile(final String fileName) { for (final String actualBackupFileNa

    1熱度

    1回答

    的Mockito我 有一個非常不同的方法調用的,我需要使用JMockit測試框架來測試返回void類型的方法調用。首先讓我們看看代碼。 public class MyClass{ MyPort port; public registerMethod(){ Holder<String> status=null; Holder<String> mess

    1熱度

    2回答

    我有以下類。 public Task { public static Task getInstance(String taskName) { return new Task(taskName); } private Task(String taskName) { this.taskName = taskName; } } 我

    1熱度

    1回答

    下測試單位如下: @Component(value = "UnitUnderTest") public class UnitUnderTest { @Resource(name = "propertiesManager") private PropertiesManager prop; public List<String> retrieveItems() {

    0熱度

    1回答

    對於單元測試的目的,我需要模擬一個以byte []作爲參數的方法。輸出將會傳遞參數。我想按照我的要求輸出。那麼有人可以幫我嘲笑嗎?

    3熱度

    1回答

    在我的測試類(CUT) - ejb中 - 我有一個私有方法「getConnection」。 我想測試CUT的另一種方法,但是這種方法將會失敗。 我試過了,如下所示,但「調用」是錯誤的。我不想調用這個方法,我想把它存根。但是如何? (「連接」是一個stub) new NonStrictExpectations() { { invoke(archivingBean, "getCon

    1熱度

    1回答

    驗證jofitit與withCapture捕獲對象不太合適。任何幫助? @Injectable private API _api; @Tested private ServiceImpl _service; @Test public void test(){ new Verifications() { { VirtualUser user;

    0熱度

    2回答

    我的應用程序使用一個保存配置設置的Singleton。這是代碼: private PropertiesSingleton() throws Exception { InputStream appstream = this.getClass().getClassLoader() .getResourceAsStream("application.properties");

    0熱度

    2回答

    我想測試一個私有方法的行爲。 「moveDataToArchive」方法執行4個步驟。 它是4x:計算日期+調用子方法。 這是我的測試: @Test public void testMoveData2Archive() throws Exception{ final long now = 123456789000L; //Necessary to make the

    0熱度

    1回答

    我想用JMockit來做行爲測試。在其中一項測試中,我需要在最終對象中調用一個方法。然而,最終的對象沒有初始化(空對象),我不知道如何在測試中初始化它(因爲它是最終定義的)。我無法找到解決方案在課堂上嘲笑最終實例。先看看測試,我會解釋代碼。 public class NetworkClientTest { @Cascading @Capturing ServerRequestHandle