title: ClassCastException when mocking generic type using Mockito
body: <p>I have a abstract test class with a generic parameter.</p>
  
  <pre><code>public abstract class AbstractCarTest&lt;G&gt; {
      ...
      @Mock
      protected G carMock;
      ...
  }
  </code></pre>
  
  <p>I've implemented a concrete test class of it.</p>
  
  <pre><code>public class TruckTest extends AbstractCarTest&lt;Truck&gt; {
      ...
      when(truckFactory.getTruck(anyString()).return(carMock);
      ...
  }
  </code></pre>
  
  <p>The method signature looks like this</p>
  
  <pre><code>public Truck getTruck(String name);
  </code></pre>
  
  <p>When running <code>TruckTest</code> I get a <code>ClassCastException</code> saying </p>
  
  <pre><code>java.lang.ClassCastException: org.mockito.internal.creation.jmock.ClassImposterizer$ClassWithSuperclassToWorkAroundCglibBug$$EnhancerByMockitoWithCGLIB$$... cannot be cast to com.example.Truck
  </code></pre>
  
  <p>Why is that? Any way I can work around that?</p>