title: Casting a parameter mock object to another object using Mockito
body: <p>I have a method to test, that begins following:</p>
  
  <pre><code>public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
      AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
      contextString = adapter.getItem(info.position);
          /.../
      }
  </code></pre>
  
  <p>I would like to test it using Mockito, but if I declare menuInfo like this:</p>
  
  <pre><code>@Mock ContextMenuInfo menuInfo
  </code></pre>
  
  <p>then I cannot compile the following statement:</p>
  
  <pre><code>Mockito.when(menuInfo.position).thenReturn(1);
  </code></pre>
  
  <p>since it is not valid for <code>ContextMenuInfo</code> object. I cannot declare my object as <code>AdapterView.AdapterContextMenuInfo</code> class, since then I get an error during run time.</p>
  
  <p>I know that in Mockito it is possible that a mock implements multiple interfaces, but the same does not apply to classes. How would it be possible to test the method I shown above? </p>