title: Checking the class type of a mock object
body: <p>I'm testing a method that gets an object and checks if that object is an instance of a class that is stored as instance variable. So far no problem.</p>
  <p>But in the test I have to use mocks and one of these mocks is the object that is passed on to that method. And now, it becomes tricky. Let's see the code (I summed up the code in this test):</p>
  <pre><code>Class&lt;AdapterEvent&gt; clazz = AdapterEvent.class;
  AdapterEvent adapterEvent = Mockito.mock(AdapterEvent.class);
      
  Assert.assertTrue(adapterEvent.getClass().equals(clazz));
  Assert.assertTrue(adapterEvent.getClass().isAssignableFrom(clazz));
  </code></pre>
  <p>Well, this test actually fails. Does anyone know why? Does somebody has an idea how I could solve this problem by still using a mock like in the test? Is there maybe another way of comparing objects to a specific class.</p>