久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <i id='gmjOA'><tr id='gmjOA'><dt id='gmjOA'><q id='gmjOA'><span id='gmjOA'><b id='gmjOA'><form id='gmjOA'><ins id='gmjOA'></ins><ul id='gmjOA'></ul><sub id='gmjOA'></sub></form><legend id='gmjOA'></legend><bdo id='gmjOA'><pre id='gmjOA'><center id='gmjOA'></center></pre></bdo></b><th id='gmjOA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='gmjOA'><tfoot id='gmjOA'></tfoot><dl id='gmjOA'><fieldset id='gmjOA'></fieldset></dl></div>
  • <legend id='gmjOA'><style id='gmjOA'><dir id='gmjOA'><q id='gmjOA'></q></dir></style></legend>
      <bdo id='gmjOA'></bdo><ul id='gmjOA'></ul>
    <tfoot id='gmjOA'></tfoot>

    <small id='gmjOA'></small><noframes id='gmjOA'>

      1. 多個級別的@Mock 和@InjectMocks

        Multiple levels of @Mock and @InjectMocks(多個級別的@Mock 和@InjectMocks)
      2. <legend id='8jhkY'><style id='8jhkY'><dir id='8jhkY'><q id='8jhkY'></q></dir></style></legend>

      3. <i id='8jhkY'><tr id='8jhkY'><dt id='8jhkY'><q id='8jhkY'><span id='8jhkY'><b id='8jhkY'><form id='8jhkY'><ins id='8jhkY'></ins><ul id='8jhkY'></ul><sub id='8jhkY'></sub></form><legend id='8jhkY'></legend><bdo id='8jhkY'><pre id='8jhkY'><center id='8jhkY'></center></pre></bdo></b><th id='8jhkY'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='8jhkY'><tfoot id='8jhkY'></tfoot><dl id='8jhkY'><fieldset id='8jhkY'></fieldset></dl></div>
              <bdo id='8jhkY'></bdo><ul id='8jhkY'></ul>

              <small id='8jhkY'></small><noframes id='8jhkY'>

                <tbody id='8jhkY'></tbody>

              1. <tfoot id='8jhkY'></tfoot>

                  本文介紹了多個級別的@Mock 和@InjectMocks的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  所以我知道在 Mockito 中,@InjectMocks 會通過 @Mock 的注解注入任何它可以注入的東西,但是如何處理這種情況呢?

                  So I understand that in Mockito @InjectMocks will inject anything that it can with the annotation of @Mock, but how to handle this scenario?

                  @Mock
                  private MockObject1 mockObject1;
                  
                  @Mock
                  private MockObject2 mockObject2;
                  
                  @InjectMocks
                  private SystemUnderTest systemUnderTest = new SystemUnderTest();
                  

                  假設 MockObject2 有一個 MockObject1 類型的屬性,而 SystemUnderTest 有一個 MockObject2 類型的屬性.我想將 mockObject1 注入到 mockObject2 中,并將 mockObject2 注入到 systemUnderTest 中.

                  Imagine that MockObject2 has an attribute that is of type MockObject1, and SystemUnderTest has an attribute of type MockObject2. I would like to have mockObject1 injected into mockObject2, and mockObject2 injected into systemUnderTest.

                  這可以通過注釋實現嗎?

                  Is this possible with annotations?

                  推薦答案

                  由于我在這里沒有得到任何回復,所以我在 Mockito 論壇上提問.這是討論的鏈接:https://groups.google.com/d/topic/mockito/hWwcI5UHFi0/討論

                  Since I didn't get any response here I asked on the Mockito forums. Here is a link to the discussion: https://groups.google.com/d/topic/mockito/hWwcI5UHFi0/discussion

                  總結答案,從技術上講,這會破壞嘲笑的目的.您實際上應該只模擬 SystemUnderTest 類所需的對象.在本身就是模擬的對象中模擬事物是毫無意義的.

                  To summarize the answers, technically this would kind of defeat the purpose of mocking. You should really only mock the objects needed by the SystemUnderTest class. Mocking things within objects that are themselves mocks is kind of pointless.

                  如果你真的想這樣做,@spy 可以提供幫助

                  If you really wanted to do it, @spy can help

                  這篇關于多個級別的@Mock 和@InjectMocks的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)
                    <tbody id='rm83o'></tbody>

                    <legend id='rm83o'><style id='rm83o'><dir id='rm83o'><q id='rm83o'></q></dir></style></legend>
                  1. <small id='rm83o'></small><noframes id='rm83o'>

                    <tfoot id='rm83o'></tfoot>
                    <i id='rm83o'><tr id='rm83o'><dt id='rm83o'><q id='rm83o'><span id='rm83o'><b id='rm83o'><form id='rm83o'><ins id='rm83o'></ins><ul id='rm83o'></ul><sub id='rm83o'></sub></form><legend id='rm83o'></legend><bdo id='rm83o'><pre id='rm83o'><center id='rm83o'></center></pre></bdo></b><th id='rm83o'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='rm83o'><tfoot id='rm83o'></tfoot><dl id='rm83o'><fieldset id='rm83o'></fieldset></dl></div>
                      <bdo id='rm83o'></bdo><ul id='rm83o'></ul>
                          1. 主站蜘蛛池模板: 一区二区三区欧美 | 久久99精品久久久久久狂牛 | 天天射影院 | 狠狠色香婷婷久久亚洲精品 | 青娱乐av| 综合久久久久 | 天天操天天插天天干 | 无人区国产成人久久三区 | 欧美精品一| 一久久久| 日韩免费视频 | 亚洲国产成人精品女人久久久野战 | 久久久久久久一区 | 99视频精品 | 欧日韩不卡在线视频 | 欧美国产视频 | 国产精品毛片在线 | 国产一区二区在线视频 | 国产精品视频一区二区三区不卡 | 亚洲最新在线视频 | 狠狠操网站 | 在线观看免费av网 | 天天激情综合 | 狠狠爱综合| 中文字幕专区 | 色综合中文 | 久久久久久久综合 | 欧区一欧区二欧区三免费 | 97国产精品视频人人做人人爱 | 在线天堂免费中文字幕视频 | 国产第一页在线播放 | 中文字幕在线视频精品 | 国产精品国产三级国产a | 欧美一二三区 | 亚洲国产高清免费 | 中文字幕精品一区久久久久 | 久久久久国产 | h视频免费看 | 成人欧美一区二区三区在线观看 | 91成人免费观看 | 日本久草|