title: How to call another method in mock object
body: <p>I have object Panel inside is Methods</p>
  
  <pre><code>protected Confirmation confim() {
      Confirmation confirmation = new Confirmation() {
          @Override
          public void onConfirm() {
              doCancel();
          }
      };
  
      return confirmation;        
  }
  
  protected void doCancel() {
      ....
  }
  </code></pre>
  
  <p>and i need to check That confirm() call doCancel Method</p>
  
  <p>My Test</p>
  
  <pre><code>@Test
  public void test() {
      Panel panel = Mockito.mock(Panel.class);
  
      Mockito.doCallRealMethod().when(panel).confirm();
      Mockito.doCallRealMethod().when(panel).cancel();
  
      panel.confirm();
  
      Mockito.verify(panel).cancel();
  }`
  </code></pre>
  
  <p>The problem is that <code>cancel()</code> is never called... maybe it is because <code>OnConfirm()</code> is an overidden method and it takes a mock... or something... Can some one help how to test? </p>
  
  <p>P.S. Panel must be Mocked.</p>
  
  <p>problem was that o dont call   panel.confirm().onConfirm();
  this is stupid mistake.. 
  so please remove this Question..</p>