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

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

        <tfoot id='pwD3p'></tfoot>
        • <bdo id='pwD3p'></bdo><ul id='pwD3p'></ul>

        Mockito:如何存根 getter setter

        Mockito: how to stub getter setter(Mockito:如何存根 getter setter)

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

                  <tbody id='goV20'></tbody>

                • 本文介紹了Mockito:如何存根 getter setter的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我是 Mockito 的新手,我想知道如何存根獲取/設置對.

                  I am kind of new to Mockito and I was wondering how I could stub a get/set pair.

                  例如

                  public interface Dummy {
                       public String getString();
                       public void setString(String string);
                  }
                  

                  如何使它們正常運行:如果在測試的某個地方調用 setString("something"); 我希望 getString() 返回something".這是可行的還是有更好的方法來處理這種情況?

                  How can I make them behave properly: if somewhere in a test I invoke setString("something"); I would like getString() to return "something". Is that feasable or is there a better way to handle such cases?

                  推薦答案

                  我還希望 getter 返回最近 setter 調用的結果.

                  I also wanted the getter to return the result of the recent setter-call.

                  擁有

                  class Dog
                  {
                      private Sound sound;
                  
                      public Sound getSound() {
                          return sound;
                      }
                      public void setSound(Sound sound)   {
                          this.sound = sound;
                      }
                  }
                  
                  class Sound
                  {
                      private String syllable;
                  
                      Sound(String syllable)  {
                          this.syllable = syllable;
                      }
                  }
                  

                  我使用以下方法將 setter 連接到 getter:

                  I used the following to connect the setter to the getter:

                  final Dog mockedDog = Mockito.mock(Dog.class, Mockito.RETURNS_DEEP_STUBS);
                  // connect getter and setter
                  Mockito.when(mockedDog.getSound()).thenCallRealMethod();
                  Mockito.doCallRealMethod().when(mockedDog).setSound(Mockito.any(Sound.class));
                  

                  這篇關于Mockito:如何存根 getter setter的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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?)

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

                              <tbody id='2yLsO'></tbody>

                            <small id='2yLsO'></small><noframes id='2yLsO'>

                            主站蜘蛛池模板: 久久久久久国 | 久久久久久久国产精品 | 成人一区二区三区在线观看 | 欧美一二三四成人免费视频 | 国产精品1区 | 日韩亚洲视频 | 国产91久久久久 | 欧美日韩一区二区在线 | 亚洲一区不卡在线 | www312aⅴ欧美在线看 | 在线视频成人 | 日韩一区二区三区av | 大乳boobs巨大吃奶挤奶 | 亚洲一区 | 日韩中文一区 | 日日拍夜夜 | 日韩福利一区 | 国产免费福利小视频 | 精品视频在线播放 | 成人国产综合 | 日韩在线视频一区 | 精品国产久 | 日本一区二区三区精品视频 | 欧美激情精品久久久久久变态 | 日韩视频在线一区 | www.国产| 黄色激情毛片 | av超碰| 成人九区| 国产一区 | 中文天堂在线一区 | 最新中文字幕在线 | 九九亚洲精品 | 国产亚洲日本精品 | 在线看中文字幕 | 国产精品视频一区二区三区 | 亚洲一区二区三区在线免费 | 亚洲 中文 欧美 日韩 在线观看 | 亚洲国产欧美在线 | 亚洲激情专区 | 青草青草久热精品视频在线观看 |