久久久久久久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>

                            主站蜘蛛池模板: 亚洲高清在线 | 欧美一区视频在线 | 欧美综合一区二区 | 久久久久免费 | 亚洲巨乳自拍在线视频 | 一道本不卡 | 国产欧美精品 | 91在线观看网址 | 男人天堂久久久 | h视频网站在线观看 | 亚洲福利在线观看 | 久久精品国产一区老色匹 | 久久久久久精 | 一区在线视频 | 日韩综合在线 | 久久久久久免费精品一区二区三区 | 午夜精品久久久久久久久久久久久 | 伊人网在线综合 | 欧美日韩亚洲三区 | 99久久精品免费看国产四区 | 国产成年人小视频 | 国产精品一区二区免费 | 日韩视频在线播放 | 亚洲 欧美 日韩在线 | 一区二区三区国产精品 | 久久久精品一区二区三区 | 亚洲精品乱码久久久久久9色 | www.亚洲| 精品欧美黑人一区二区三区 | 亚洲国产情侣 | 毛片免费看的 | 国产日韩一区二区三免费高清 | 中文字幕在线观看www | 久久久久久久久久久久亚洲 | 欧美激情黄色 | 午夜欧美 | 中文字幕在线观看日韩 | 久久免费精品 | 午夜精品久久久久久久久久久久久 | 欧美中文字幕一区二区三区 | 精品国产欧美在线 |