テスト対象のクラスSampleA をテスト対象のクラスにします。 このクラスは、SampleB を使っています。 public class SampleA { private SampleB sampleB; public String createName() { int id = 1; String ret = sampleB.getName(id); return ret; } } こちらが、SampleB のクラスです。 public class SampleB { public String getName(Integer id) { String name = null; if (id == 1) { name = "test1"; } else if (id == 2) { name = "test2"; } else { name = "other"; } return n
![テックノート – Junitライブラリ「Mockito」のverifyの使い方](https://cdn-ak-scissors.b.st-hatena.com/image/square/0971da2a2618dc3f93cc204bac0cffd545f8d18a/height=288;version=1;width=512/https%3A%2F%2Fi1.wp.com%2Fjavatechnology.net%2Fwp-content%2Fuploads%2Fmockito.png%3Ffit%3D328%252C200)