メソッドの途中で計算された値を、他のメソッドの引数として使うというケースをテストすることがままあります。 Mockitoを使ったテストは以下のようになるでしょう。 (テスト対象) public class Foo { public void doSomething() { final StringBuilder sb = new StringBuilder(); // sbに色々appendする処理 this.doOtherthing(sb.toString()); } void doOtherthing(String bar) { // 何かの処理 } } (テスト) import static org.mockito.Mockito.*; public class FooTest { @Test public void doSomething() { final Foo foo = s