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

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

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

  • <legend id='AGbfL'><style id='AGbfL'><dir id='AGbfL'><q id='AGbfL'></q></dir></style></legend>
    • <bdo id='AGbfL'></bdo><ul id='AGbfL'></ul>

      <tfoot id='AGbfL'></tfoot>
      1. Mockito thenReturn 返回相同的實例

        Mockito thenReturn returns same instance(Mockito thenReturn 返回相同的實例)
        <i id='jJUG4'><tr id='jJUG4'><dt id='jJUG4'><q id='jJUG4'><span id='jJUG4'><b id='jJUG4'><form id='jJUG4'><ins id='jJUG4'></ins><ul id='jJUG4'></ul><sub id='jJUG4'></sub></form><legend id='jJUG4'></legend><bdo id='jJUG4'><pre id='jJUG4'><center id='jJUG4'></center></pre></bdo></b><th id='jJUG4'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='jJUG4'><tfoot id='jJUG4'></tfoot><dl id='jJUG4'><fieldset id='jJUG4'></fieldset></dl></div>
            <tbody id='jJUG4'></tbody>

        • <legend id='jJUG4'><style id='jJUG4'><dir id='jJUG4'><q id='jJUG4'></q></dir></style></legend>
        • <tfoot id='jJUG4'></tfoot>

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

              • <bdo id='jJUG4'></bdo><ul id='jJUG4'></ul>

                1. 本文介紹了Mockito thenReturn 返回相同的實例的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我在 Mockito 中有這個:

                  I have this in Mockito:

                  when(mockedMergeContext.createNewEntityOfType(IService.class)).thenReturn(new ServiceMock());
                  

                  createNewEntityOfType 方法應該總是返回一個新的 ServiceMock 實例,但它會返回兩次相同的引用.

                  The createNewEntityOfType method should always return a new ServiceMock instance but it returns twice the same reference.

                  為什么 thenReturn 方法沒有返回新的 ServiceMock?

                  Why the thenReturn method doesn't return new ServiceMock?

                  推薦答案

                  thenReturn 方法將始終返回傳遞給它的內容.new Servicemock() 代碼在調用 thenReturn 之前被執行.然后將創建的 ServiceMock 傳遞給 thenReturn.因此 thenReturn 具有 ServiceMock 的絕對實例,而不是創建機制.

                  The thenReturn method will always return what is passed to it. The code new Servicemock() is being executed prior to the call to thenReturn. The created ServiceMock is then being passed to thenReturn. Therefore thenReturn has a absolute instance of ServiceMock not a creation mechanism.

                  如果您需要提供新實例,請使用 thenAnswer

                  If you need to provide an new instance, use thenAnswer

                  when(mockedMergeContext.createNewEntityOfType(IService.class))
                    .thenAnswer(new Answer<IService>() {
                       public IService answer(InvocationOnMock invocation) {
                          return new ServiceMock();
                       }
                     });
                  

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

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

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

                          <tfoot id='QUgsb'></tfoot>
                            <bdo id='QUgsb'></bdo><ul id='QUgsb'></ul>
                            <legend id='QUgsb'><style id='QUgsb'><dir id='QUgsb'><q id='QUgsb'></q></dir></style></legend>

                          • 主站蜘蛛池模板: 免费的av网站 | 最新91在线 | 久久无毛 | 中文字幕免费在线观看 | 国产精品视频一区二区三区不卡 | 欧美一区二区三区免费电影 | 日本一二三区在线观看 | 91日韩 | 国产乱性 | 精品96久久久久久中文字幕无 | 国产亚洲精品美女久久久久久久久久 | 国产在线观看不卡一区二区三区 | 久久精品99久久 | 亚洲精品在线播放 | 福利网址 | 国产精品欧美一区二区三区 | 日本小电影网站 | 精品亚洲一区二区三区 | 四虎永久免费黄色影片 | av天天操 | 日韩在线三级 | av中文在线 | 91新视频 | 国产福利在线 | 国产999精品久久久 日本视频一区二区三区 | 成人在线免费网站 | 亚洲九九色 | 青青伊人久久 | 欧美成人免费在线 | 91精品国产乱码久久久 | av一区二区三区在线观看 | 久久成人精品视频 | 亚洲视频免费在线观看 | 夜夜草 | 免费一级做a爰片久久毛片潮喷 | 午夜网| 高清色| 国产精品永久在线观看 | 91精品国产91久久久久久最新 | 99亚洲综合| 日韩精品1区2区 |