title: Mockito verify on Class object NotAMockException
body: <p>i'm trying to write a test for the following static method:</p>
  
  <pre><code>public static Field getField (Class&lt;?&gt; type, String fieldName) {
      for (Field field : type.getDeclaredFields()) {
          if (field.getName().equals(fieldName)) {
              return field;
          }
      }
  
      if (type.getSuperclass() != null) {
          return getField(type.getSuperclass(), fieldName);
      }
  
      return null;
  }
  </code></pre>
  
  <p>This is my test code:</p>
  
  <pre><code>@Test
  public void getFieldTest () {
      class StupidObject { Object stupidField; }
      class ReallyStupidObject extends StupidObject { Object reallyStupidField; }
      ReallyStupidObject reallyStupidObject = mock(ReallyStupidObject.class);
      // --------------------------------------------------
      Field field = FSUtils.getField(reallyStupidObject.getClass(), "stupidField");
      // --------------------------------------------------
      verify(reallyStupidObject.getClass()).getDeclaredFields();
      verify(reallyStupidObject.getClass()).getSuperclass();
      verify(reallyStupidObject.getClass().getSuperclass()).getDeclaredFields();
      verify(reallyStupidObject.getClass().getSuperclass(), never()).getSuperclass();
      assertEquals(field.getName(), "stupidField");
  }
  </code></pre>
  
  <p>Which results in this error:</p>
  
  <blockquote>
    <p>org.mockito.exceptions.misusing.NotAMockException:  Argument passed to
    verify() is of type Class and is not a mock!</p>
  </blockquote>
  
  <p>Can anyone shed some light on how i can verify methods are called on Class objects?</p>
  
  <p>Many thanks!</p>
  
  <p>Ben.</p>