title: Mockito doNothing doesn't work when a Method called with void method call inside
body: <p><strong>Main Class</strong></p>
  
  <pre><code>public class BootSample {
  
      public int call(int m) {
          System.out.println("Entering into Call Method");
          int n = m*10;
          TestUtil testUtil = new TestUtil();
          testUtil.add(m, n);
          System.out.println("End of Call Method Value n : " + n);
          return n;
      }
  
  }
  </code></pre>
  
  <p><strong>Util Class</strong></p>
  
  <pre><code>public class TestUtil {
  
      public void add(int a, int b) {
          System.out.println(" Entering into TestUtil Method ");
          int c = a +b;
          System.out.println(" End of TestUtil Method Value : " + c);
      }
  
  }
  </code></pre>
  
  <p><strong>Test Class</strong></p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class BootSampleTest {
  
      @Mock
      TestUtil testUtil; 
  
      @Before
      public void setup() {
  
      }
  
      @Test
      public void utilSuccess() throws Exception {
          BootSample bootSample = new BootSample();
          doNothing().when(testUtil).add(any(Integer.class),any(Integer.class));
          int result = bootSample.call(10); 
          assertEquals(result,100);
      }
  
  }
  </code></pre>
  
  <p>Output : </p>
  
  <pre><code>Entering into Call Method
   Entering into TestUtil Method 
   End of TestUtil Method Value : 110
  End of Call Method Value n : 100
  </code></pre>
  
  <hr>
  
  <p>I'm trying to mock util void method call with doNothing but doesn't work.Can anyone please help me with solution? I'm stuck with similar functionality in our application.</p>