title: Problems with mocking restTemplate
body: <p>Here's my controller:</p>
  
  <pre><code>    @RequestMapping(
          value = "/{owner}/{repositoryName}",
          method = RequestMethod.GET,
          produces = "application/json"
  )
  public RepoInfo repoInfo(@PathVariable String owner, @PathVariable String repositoryName) {
      return restTemplate.getForObject(githubApiUrl + owner + "/" + repositoryName, RepoInfo.class);
  }
  </code></pre>
  
  <p>And here are tests methods:</p>
  
  <pre><code>    @Before
  public void mockGithubApiResponse() {
      Mockito.when(restTemplate.getForObject(githubApiUrl + dummyOwner + "/" + dummyRepoName, RepoInfo.class)).thenReturn(dummyRepoInfoObject);
  }
  
      @Test
  public void shouldReturnRepoInfoObject() throws Exception {
  
      Gson gson = new Gson();
      String jsonRepo = gson.toJson(dummyRepoInfoObject);
  
      this.mockMvc.perform(get("http://localhost:" + this.port + "/" + repoControllerMappingPrefix + dummyOwner + "/" + dummyRepoName)
              .accept(MediaType.APPLICATION_JSON))
              .andExpect(status().isOk())
              .andExpect(content().json(jsonRepo));
  }
  </code></pre>
  
  <p>But it doesn't seem to mock anything. The controller is still responding based on external service.</p>