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

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

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

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

        <tfoot id='cSfQN'></tfoot>

          <bdo id='cSfQN'></bdo><ul id='cSfQN'></ul>

        無法使用 Mockito 返回類對象

        Can#39;t return Class Object with Mockito(無法使用 Mockito 返回類對象)
          <tbody id='BZQP1'></tbody>
      1. <i id='BZQP1'><tr id='BZQP1'><dt id='BZQP1'><q id='BZQP1'><span id='BZQP1'><b id='BZQP1'><form id='BZQP1'><ins id='BZQP1'></ins><ul id='BZQP1'></ul><sub id='BZQP1'></sub></form><legend id='BZQP1'></legend><bdo id='BZQP1'><pre id='BZQP1'><center id='BZQP1'></center></pre></bdo></b><th id='BZQP1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BZQP1'><tfoot id='BZQP1'></tfoot><dl id='BZQP1'><fieldset id='BZQP1'></fieldset></dl></div>

          <tfoot id='BZQP1'></tfoot>

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

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

                  <bdo id='BZQP1'></bdo><ul id='BZQP1'></ul>
                  本文介紹了無法使用 Mockito 返回類對象的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試編寫一個單元測試,為此我正在為 Mockito 模擬編寫一個 when 語句,但我似乎無法讓 eclipse 認識到我的返回值是有效的.

                  I'm trying to write a unit test, and to do that I'm writing a when statement for a Mockito mock, but I can't seem to get eclipse to recognize that my return value is valid.

                  這就是我正在做的事情:

                  Here's what I'm doing:

                  Class<?> userClass = User.class;
                  when(methodParameter.getParameterType()).thenReturn(userClass);
                  

                  .getParameterType()的返回類型是Class<?>,所以不明白eclipse為什么說,方法thenReturn(Class<capture#1-of ?>) 類型為 OngoingStubbing<Class<capture#1-of ?>>不適用于參數 (Class<capture#2-of ?>).它提供了轉換我的 userClass,但這只會使一些亂碼 eclipse 說它需要再次轉換(并且不能轉換).

                  The return type of .getParameterType() is Class<?>, so I don't understand why eclipse says, The method thenReturn(Class<capture#1-of ?>) in the type OngoingStubbing<Class<capture#1-of ?>> is not applicable for the arguments (Class<capture#2-of ?>). It offers to cast my userClass, but that just makes some garbled stuff eclipse says it needs to cast again (and can't cast).

                  這只是 Eclipse 的問題,還是我做錯了什么?

                  Is this just an issue with Eclipse, or am I doing something wrong?

                  推薦答案

                  另外,一個更簡潔的解決方法是使用 do 語法而不是 when.

                  Also, a slightly more terse way to get around this is to use the do syntax instead of when.

                  doReturn(User.class).when(methodParameter).getParameterType();
                  

                  這篇關于無法使用 Mockito 返回類對象的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)

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

                      <small id='7GLar'></small><noframes id='7GLar'>

                        <tbody id='7GLar'></tbody>
                      • <bdo id='7GLar'></bdo><ul id='7GLar'></ul>

                            主站蜘蛛池模板: 亚洲欧洲精品在线 | 中文字幕电影在线观看 | 亚洲国产aⅴ精品一区二区 免费观看av | www312aⅴ欧美在线看 | 亚洲 成人 在线 | 亚洲69p | 亚洲国产欧美日韩 | 狠狠婷婷综合久久久久久妖精 | 国产第二页| 不卡一区二区三区四区 | 国产乱码精品一区二区三区五月婷 | 亚洲视频在线观看免费 | 久久男人 | 亚洲精选一区 | 国产特一级黄色片 | 国产一级特黄真人毛片 | 在线观看国产精品视频 | 91一区二区三区在线观看 | 成人久久久 | 日韩在线精品强乱中文字幕 | 午夜a√| 日本天天操 | 日韩中文字幕一区二区三区 | 久久精品日 | 国产精品夜间视频香蕉 | www视频在线观看 | 91精品国产一区二区三区 | 久久久久久99 | 久久久久国产精品一区三寸 | 伊人网99 | 九九免费视频 | 国色天香成人网 | 国产一区二区精品在线观看 | 在线视频h | 久久精品中文字幕 | 伊人免费网 | 日韩三区 | 日本亚洲一区 | 日本激情视频中文字幕 | 蜜桃视频在线观看www社区 | 中文字幕二区 |