@Test void updateHeadline() throws Exception { KeycloakAuthenticationToken principal = mock(KeycloakAuthenticationToken.class); when(profileService.getArkaneAccessToken(principal)).thenReturn("token"); mockMvc.perform(post("/profile/headline") .param("headline", "headline") .principal(principal)) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl("/profile")); verify(profileService).updateHeadline(principal, "headline"); }
@PostMapping("/profile/headline") public ModelAndView updateHeadline(Principal principal, @RequestParam("headline") String headline) { profileService.updateHeadline(principal, headline); return redirectToProfile(); }
ProfileController { @PostMapping("/profile/headline") public ModelAndView updateHeadline(Principal principal, @RequestParam("headline") String headline) { profileService.updateHeadline(principal, headline); return redirectToProfile(); } }
ProfileController { @PostMapping("/profile/headline") public ModelAndView updateHeadline(Principal principal, @RequestParam("headline") String headline) { profileService.updateHeadline(principal, headline); return redirectToProfile(); } ProfileController(final ApplicationEventPublisher eventPublisher,
                             final ProfileService profileService,
                             final MessageService messageService,
                             final ReferralService referralService,
                             final GithubBountyService githubBountyService,
                             final @Value("${network.arkane.environment}") String arkaneEnvironment,
                             final StackOverflowBountyService stackOverflowBountyService); }
ProfileController { @PostMapping("/profile/headline") public ModelAndView updateHeadline(Principal principal, @RequestParam("headline") String headline) { profileService.updateHeadline(principal, headline); return redirectToProfile(); } ProfileController(final ApplicationEventPublisher eventPublisher,
                             final ProfileService profileService,
                             final MessageService messageService,
                             final ReferralService referralService,
                             final GithubBountyService githubBountyService,
                             final @Value("${network.arkane.environment}") String arkaneEnvironment,
                             final StackOverflowBountyService stackOverflowBountyService); @GetMapping("/profile") ModelAndView showProfile(Principal principal); @GetMapping("/profile/link/{provider}") ModelAndView linkProfile(@PathVariable String provider,
                                    HttpServletRequest request,
                                    Principal principal,
                                    @RequestParam(value = "redirectUrl", required = false) String redirectUrl); @GetMapping("/profile/managewallets") ModelAndView manageWallets(Principal principal, HttpServletRequest request); @PostMapping("/profile/headline") ModelAndView updateHeadline(Principal principal, @RequestParam("headline") String headline); @GetMapping("/profile/link/{provider}/redirect") ModelAndView redirectToHereAfterProfileLink(Principal principal,
                                                       @PathVariable("provider") String provider,
                                                       @RequestParam(value = "redirectUrl", required = false) String redirectUrl); }
ProfileController { @PostMapping("/profile/headline") public ModelAndView updateHeadline(Principal principal, @RequestParam("headline") String headline) { profileService.updateHeadline(principal, headline); return redirectToProfile(); } ProfileController(final ApplicationEventPublisher eventPublisher,
                             final ProfileService profileService,
                             final MessageService messageService,
                             final ReferralService referralService,
                             final GithubBountyService githubBountyService,
                             final @Value("${network.arkane.environment}") String arkaneEnvironment,
                             final StackOverflowBountyService stackOverflowBountyService); @GetMapping("/profile") ModelAndView showProfile(Principal principal); @GetMapping("/profile/link/{provider}") ModelAndView linkProfile(@PathVariable String provider,
                                    HttpServletRequest request,
                                    Principal principal,
                                    @RequestParam(value = "redirectUrl", required = false) String redirectUrl); @GetMapping("/profile/managewallets") ModelAndView manageWallets(Principal principal, HttpServletRequest request); @PostMapping("/profile/headline") ModelAndView updateHeadline(Principal principal, @RequestParam("headline") String headline); @GetMapping("/profile/link/{provider}/redirect") ModelAndView redirectToHereAfterProfileLink(Principal principal,
                                                       @PathVariable("provider") String provider,
                                                       @RequestParam(value = "redirectUrl", required = false) String redirectUrl);  }