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

  • <tfoot id='mapqV'></tfoot>

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

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

        mockito ArrayList&lt;String&gt;問題

        mockito ArrayListlt;Stringgt; problem(mockito ArrayListlt;Stringgt;問題)
        <i id='OU2sZ'><tr id='OU2sZ'><dt id='OU2sZ'><q id='OU2sZ'><span id='OU2sZ'><b id='OU2sZ'><form id='OU2sZ'><ins id='OU2sZ'></ins><ul id='OU2sZ'></ul><sub id='OU2sZ'></sub></form><legend id='OU2sZ'></legend><bdo id='OU2sZ'><pre id='OU2sZ'><center id='OU2sZ'></center></pre></bdo></b><th id='OU2sZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='OU2sZ'><tfoot id='OU2sZ'></tfoot><dl id='OU2sZ'><fieldset id='OU2sZ'></fieldset></dl></div>

            1. <legend id='OU2sZ'><style id='OU2sZ'><dir id='OU2sZ'><q id='OU2sZ'></q></dir></style></legend>

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

                  <bdo id='OU2sZ'></bdo><ul id='OU2sZ'></ul>
                • <tfoot id='OU2sZ'></tfoot>
                    <tbody id='OU2sZ'></tbody>
                • 本文介紹了mockito ArrayList&lt;String&gt;問題的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個方法,我正在嘗試進行單元測試.此方法將參數作為 ArrayList 并對其進行處理.我試圖定義的模擬是:

                  I have a method that I am trying to unit test. This method takes a parameter as an ArrayList and does things with it. The mock I am trying to define is:

                  ArrayList<String> mocked = mock(ArrayList.class);
                  

                  這會給出 [unchecked] unchecked conversion"警告.

                  which gives a [unchecked] unchecked conversion" warning.

                  ArrayList<String> mocked = mock(ArrayList<String>.class);
                  

                  給我一??個錯誤.

                  有人愿意告訴我我做錯了什么嗎?

                  Anyone care to enlighten me as to what I am doing wrong?

                  推薦答案

                  替代方案是使用@Mock注解,因為Mockito可以使用類型反射來找到泛型類型:

                  The alternative is to use the @Mock annotation since then Mockito can use type reflection to find the generic type:

                  public class MyTest {
                  
                    @Mock
                    private ArrayList<String> mockArrayList;
                  
                    ...
                  
                    public void setUp() {
                      MockitoAnnotations.initMocks(this);
                    }
                  
                    public void testMyTest() {
                      when(mockArrayList.get(0)).thenReturn("Hello world");
                  
                      String result = mockArrayList.get(0);
                  
                      assertEquals("Should have the correct string", "Hello world", result);
                  
                      verify(mockArrayList).get(0);
                    }
                  }
                  

                  這篇關于mockito ArrayList&lt;String&gt;問題的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)

                  1. <small id='RN1Kd'></small><noframes id='RN1Kd'>

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

                          • <tfoot id='RN1Kd'></tfoot>

                              <tbody id='RN1Kd'></tbody>
                            主站蜘蛛池模板: 国产一区二区三区四区三区四 | 在线免费观看黄a | 亚洲一区二区三 | 久久精品亚洲 | www成人啪啪18| 99热视| 亚洲一区二区三区欧美 | 欧美一级全黄 | 亚洲九色 | 欧美日韩国产中文 | 午夜大片 | 黑人精品xxx一区一二区 | 久色激情| 欧洲亚洲视频 | 日韩中文字幕在线观看 | 密色视频 | 亚洲v日韩v综合v精品v | 免费午夜视频 | 国产精品国色综合久久 | 午夜视频一区二区 | 久优草 | 国内毛片毛片毛片毛片 | 开操网| 青青草综合 | 少妇久久久久 | 四虎成人在线播放 | 国产一区二区精品在线 | 99精品国产一区二区青青牛奶 | 99re在线观看 | 国产大片一区 | 狠狠av | 在线午夜 | 国产激情福利 | 成人午夜免费在线视频 | av在线播放网址 | 涩爱av一区二区三区 | 久久高潮| 国产一级毛片精品完整视频版 | 免费久久视频 | 伊人网国产| 久久午夜视频 |