### Question:
HomeController extends AbstractController { @RequestMapping("/user/login") public ModelAndView login(RedirectAttributes redirectAttributes, HttpServletRequest request) { return redirectView(redirectAttributes) .url(request.getHeader("referer")) .build(); } HomeController(ProfileService profileService,
                          ApplicationEventPublisher eventPublisher,
                          final RequestService requestService,
                          final ObjectMapper objectMapper,
                          final Mappers mappers); @RequestMapping("/") ModelAndView home(@RequestParam(value = "ref", required = false) String ref, RedirectAttributes redirectAttributes, Principal principal); @GetMapping(value = {"/requestsActiveCount"}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseBody String getRequestsActiveCount(Principal principal); @RequestMapping("/user/login") ModelAndView login(RedirectAttributes redirectAttributes, HttpServletRequest request); @GetMapping(path = "/logout") String logout(Principal principal, HttpServletRequest request);  }### Answer:
@Test public void login() throws Exception { mockMvc.perform(get("/user/login").header("referer", "localhost")) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl("localhost")); }