### Question:
HttpProxyController { @RequestMapping("/proxy.action") public @ResponseBody ResponseEntity<?> doProxy(HttpServletRequest request, @RequestParam String baseUrl, @RequestParam(required = false) Map<String, String> params) { return proxyService.doProxy(request, baseUrl, params); }  @RequestMapping("/proxy.action") @ResponseBody ResponseEntity<?> doProxy(HttpServletRequest request, @RequestParam String baseUrl, @RequestParam(required = false) Map<String, String> params); void setProxyService(HttpProxyService proxyService);  }### Answer:
@Test public void proxyShouldWorkAsExpected() throws Exception { String baseUrl = "https: final String body = "TEST"; ResponseEntity mockedResponse = new ResponseEntity(body, null, HttpStatus.OK); Mockito.when(proxyService.doProxy( Matchers.any(HttpServletRequest.class), Matchers.any(String.class), Matchers.any(Map.class)) ).thenReturn(mockedResponse); MvcResult result = mockMvc.perform(MockMvcRequestBuilders.get(PROXY_ENDPOINT) .param("baseUrl", baseUrl)) .andExpect(MockMvcResultMatchers.status().isOk()).andReturn(); String content = result.getResponse().getContentAsString(); Assert.assertEquals("Returned body matched mocked one.", body, content); Mockito.verify(proxyService, Mockito.times(1)). doProxy(Matchers.any(HttpServletRequest.class), Matchers.any(String.class), Matchers.any(Map.class)); Mockito.verifyNoMoreInteractions(proxyService); }