title: Why mockMVC and mockito don't work together?
body: <p>I have restful services and I want to unit test them without connecting to database, therefore I have written this piece of code:</p>
  
  <pre><code>@Before
  public void setup() throws Exception {
      this.mockMvc = webAppContextSetup(webApplicationContext).build();
  
      adminDao = mock(AdminDaoImpl.class);
      adminService = new AdminServiceImpl(adminDao);
  }
  
  @Test
  public void getUserList_test() throws Exception {
      User user = getTestUser();
      List&lt;User&gt; expected = spy(Lists.newArrayList(user));
  
      when(adminDao.selectUserList()).thenReturn(expected);
  
  
      mockMvc.perform(get("/admin/user"))
          .andExpect(status().isOk())
          .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
          .andExpect(jsonPath("$", hasSize(1)))
          ;           
  }
  </code></pre>
  
  <p>The service gets called but my problem is this line of code </p>
  
  <pre><code>when(adminDao.selectUserList()).thenReturn(expected);
  </code></pre>
  
  <p>is not working, I mean it really calls the adminDao.select method and therefore gets the result from database. which I don't want.
  Do you have any idea how can I mock the method call?</p>