久久久久久久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 返回相同的實(shí)例

        Mockito thenReturn returns same instance(Mockito thenReturn 返回相同的實(shí)例)
        <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 返回相同的實(shí)例的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我在 Mockito 中有這個(gè):

                  I have this in Mockito:

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

                  createNewEntityOfType 方法應(yīng)該總是返回一個(gè)新的 ServiceMock 實(shí)例,但它會(huì)返回兩次相同的引用.

                  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 方法將始終返回傳遞給它的內(nèi)容.new Servicemock() 代碼在調(diào)用 thenReturn 之前被執(zhí)行.然后將創(chuàng)建的 ServiceMock 傳遞給 thenReturn.因此 thenReturn 具有 ServiceMock 的絕對實(shí)例,而不是創(chuàng)建機(jī)制.

                  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.

                  如果您需要提供新實(shí)例,請使用 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();
                       }
                     });
                  

                  這篇關(guān)于Mockito thenReturn 返回相同的實(shí)例的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數(shù)溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關(guān)系嗎?)
                  How to convert Integer to int?(如何將整數(shù)轉(zhuǎn)換為整數(shù)?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內(nèi)創(chuàng)建一個(gè)隨機(jī)打亂數(shù)字的 int 數(shù)組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠?qū)?0xff000000 存儲(chǔ)為 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>

                          • 主站蜘蛛池模板: 欧美久久不卡 | 精品一区二区在线观看 | 日日干日日色 | 成人国产精品久久久 | 国产福利在线小视频 | 久草资源在线视频 | 99综合 | 精品一级毛片 | av手机在线免费观看 | 黄色片视频免费 | 狠狠操你 | 国产日韩一区二区三区 | 欧美久久精品一级黑人c片 91免费在线视频 | 国产a爽一区二区久久久 | 欧洲一区二区三区 | 激情综合五月 | 国产丝袜一区二区三区免费视频 | 国产男人的天堂 | 日韩福利在线 | www.午夜| 久草网站 | 成人福利电影 | 九九热免费在线观看 | 精品国产欧美一区二区三区成人 | 国产精品久久久久久亚洲调教 | 另类专区成人 | 在线视频 亚洲 | 亚洲精品精品 | 国产精品视频网 | 成人欧美| 特级黄一级播放 | 久久精品小视频 | 玖玖免费 | 伊人色综合久久天天五月婷 | 精品久久av | 亚洲国产视频一区二区 | 91精品国产91久久久久久吃药 | аⅴ资源新版在线天堂 | 国产专区在线 | 又黄又色 | 无码日韩精品一区二区免费 |