久久久久久久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. 主站蜘蛛池模板: 国产精品美女久久久久久久久 | 国产午夜精品一区二区三区视频 | 日韩国产一区二区 | 久久久精品网 | 日韩精品综合 | 国产黄色一级片 | 国产成人91 | 精品国产一区二区三 | 狠狠干av| 欧美日韩综合在线 | 亚洲午夜18毛片在线看 | 一级片免费播放 | 久久激情网 | 人人爽人人澡 | 国产h视频在线观看 | 亚洲欧美视频在线 | 国产性猛交96 | 久艹视频在线观看 | 五月天久久久 | 亚洲国产成人av | 黄色三级视频在线观看 | 91们嫩草伦理| 成人在线视频免费观看 | 少妇精品视频 | 国产精品久久午夜夜伦鲁鲁 | 极品美女一区二区三区 | 国产一区二区三区免费播放 | 伊人av网 | 日韩黄色在线观看 | 久久爱综合 | 亚洲一区二区三区免费 | 蜜臀99久久精品久久久久小说 | 国产精品第一区 | 天天干天天弄 | 国产精品免费在线播放 | 一级黄色免费视频 | 久久久久久久久久久国产 | 欧美日韩免费看 | 红桃av在线 | 国产一区免费视频 | 狠狠干2018|