title: Argument passed to verify is not a Mock
body: <p>I'm new to writing tests in Java and trying to learn Mockito. </p>
  
  <p>This is part of the class I want to test.</p>
  
  <pre><code>public class ExamRepository implements IExamRepository {
      private static final Logger LOGGER = LogManager.getLogger(ExamRepository.class);
  
      private IStudentRepository studentRepository = new StudentRepository();
      private EntityManager entityManager;
  
      public ExamRepository() {
          entityManager = EntityController.getEntityManager();
      }
  
      public ExamRepository(EntityManager entityManager){
          this.entityManager = entityManager;
      }
  
      // Get all exam skeletons from the DB
      @Override
      public List&lt;ExamSkeleton&gt; getAllSkeletons() {
          try {
              TypedQuery&lt;ExamSkeleton&gt; query = entityManager.createQuery("SELECT NEW ExamSkeleton (s.id, s.filename, s.course, s.visible) FROM ExamSkeleton as s", ExamSkeleton.class);
  
              return query.getResultList();
          } catch (IllegalArgumentException exception) {
              LOGGER.error(exception);
          }
  
          return Collections.emptyList();
      }
  }
  </code></pre>
  
  <p>This is the actual test I wrote, I have a feeling the error:
  Argument passed to verify() is of type ExamRepository and is not a mock!</p>
  
  <p>Is occurring because of this line:</p>
  
  <pre><code>examRepository = new ExamRepository(entityManager);
  </code></pre>
  
  <p>However I am uncertain as to how to rewrite it. I am also not sure what else I should be testing for except for the fact that it ran once.</p>
  
  <pre><code>public class ExamRepositoryTest {
      @InjectMocks
      private ExamRepository examRepository;
  
      @Mock
      private EntityManager entityManager;
  
      @Rule
      public MockitoRule mockitoRule = MockitoJUnit.rule();
  
      @Test
      public void canGetAllSkeletons(){
          examRepository = new ExamRepository(entityManager);
  
          List&lt;ExamSkeleton&gt; examSkeletons = new ArrayList&lt;&gt;();
          examSkeletons.add(new ExamSkeleton());
          examSkeletons.add(new ExamSkeleton());
  
          TypedQuery query = mock(TypedQuery.class);
          when(entityManager.createQuery(anyString(), Matchers.anyObject())).thenReturn(query);
          when(query.getResultList()).thenReturn(examSkeletons);
  
          verify(examRepository, times(1)).getAllSkeletons();
      }
  }
  </code></pre>
  
  <p>Hope you guys can put me on the correct track!</p>