title: Avoiding unchecked warnings when using Mockito
body: <p>I'd like to mock a call on <code>ScheduledExecutorService</code> to return mock of <code>ScheduledFuture</code> class when method <code>schedule</code> is invoked. The following code compiles and works correctly:</p>
  
  <pre><code>    ScheduledExecutorService executor = Mockito.mock(ScheduledExecutorService.class);
      ScheduledFuture future = Mockito.mock(ScheduledFuture.class);
      Mockito.when(executor.schedule(
          Mockito.any(Runnable.class),
          Mockito.anyLong(),
          Mockito.any(TimeUnit.class))
      ).thenReturn(future); // &lt;-- warning here
  </code></pre>
  
  <p>except that I'm getting unchecked warning in the last line: </p>
  
  <pre><code>found raw type: java.util.concurrent.ScheduledFuture
    missing type arguments for generic class java.util.concurrent.ScheduledFuture&lt;V&gt;
  
   unchecked method invocation: method thenReturn in interface org.mockito.stubbing.OngoingStubbing is applied to given types
    required: T
    found: java.util.concurrent.ScheduledFuture
  
  unchecked conversion
    required: T
    found:    java.util.concurrent.ScheduledFuture
  </code></pre>
  
  <p>Is it possible to somehow avoid these warnings?</p>
  
  <p>Code like <code>ScheduledFuture&lt;?&gt; future = Mockito.mock(ScheduledFuture.class);</code> doesn't compile.</p>