mockito

    0熱度

    1回答

    我有春天接口UserDetailsService的實現: @Service public class UserDetailsServiceImpl implements UserDetailsService { private final UserRepository userRepository; @Autowired public UserDetailsSe

    0熱度

    1回答

    我已經寫了JUnit測試: @Service public class EnterpriseCustomerVerificationService { @Autowired CreditCheckRepository creditCheckRepository; public String FTACheck(StandardInputHeader charterHeaderInputI

    0熱度

    2回答

    我正在測試我的Spring MVC應用程序。 要求是模擬SecurityContext,但我需要Authentication與一些名稱,非空。有沒有辦法做到這一點? 這裏是我的代碼: Authentication auth = Mockito.mock(Authentication.class); SecurityContext secCont = Mockito.mock(SecurityCo

    1熱度

    2回答

    我有數倍BarService相關重載update方法就可以了,就像這樣: BarService#update(Bar bar); BarService#update(Bar bar, boolean checkX); BarService#update(Bar bar, boolean checkX, boolean checkY); 我想,以確保他們的沒有被稱爲在一個特定的測試。目前,我

    0熱度

    1回答

    我正在爲我的Spring MVC控制器編寫測試。 我得到一個org.Mockito.exception.verifications.NoInteractionWanted例外,該堆棧跟蹤: 無相互作用想在這裏: - >在com.test.TestInsertUtente.testInserimentoUtente(TestInsertUtente.java:124) 但發現這種互動: - >在co

    1熱度

    1回答

    我需要測試一個將列表作爲參數的方法。以下是示例代碼: public class C { private int x; private String y; //getters and setters } public class B { public void collectC(List<C> cList) { for(C c :

    1熱度

    2回答

    下面的示例工作正確。問題是我確實需要@InjectMocks註釋。並且,當我用MockitoJUnitRunner.class替換SpringJUnit4ClassRunner.class時,所有內容都會中斷(bar = null而不是testValue)。 如何解決? //@RunWith(MockitoJUnitRunner.class) // not work ( @RunWith(Spri

    1熱度

    1回答

    執行下面的測試後,我看到下面的異常。我在代碼庫中改變的全部是使用MimeMessage而不是SimpleMailMessage。 請指導。 異常 ------------------------------------------------------- T E S T S ------------------------------------------------------- Ru

    1熱度

    1回答

    以下是我的代碼設計。我需要指導,如何爲它編寫測試用例。 abstract class X { public void xyz() { A a = getA(); callMe(a); } private A getA() { //do some stuff return a; }

    0熱度

    1回答

    我試圖在Spring-Boot應用程序中對restController進行測試。 我想測試的方法是依賴於依賴於MongoRepository的服務的crud方法(插入)。 我已經做了如下,但我不明白爲什麼測試不工作,經過許多網絡研究。 @RunWith(SpringRunner.class) @WebMvcTest(value = ConfigTagController.class, secur