以下の内容はhttps://kuxumarin.hatenablog.com/entry/2018/10/29/004708より取得しました。


Mockito で void なメソッドをモックする

Mockito はいいぞ〜

さて、 void なメソッドを mock するにはどうすれば良いのかってのは少しハマったので書いてきます〜

解決方法

doNothing().when(targetMock).targetMethod() 的な感じで実装してくといけました〜。

コードで解説

val keyword = "hello world"
doNothing().`when`(target).hoge(keyword)
target.hoge(keyword)
verify(target, times(1)).hoge(keyword)



以上の内容はhttps://kuxumarin.hatenablog.com/entry/2018/10/29/004708より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14