@Test void showProfile() throws Exception { MessageDto messageDto1 = MessageDto.builder() .type(MessageType.REFERRAL_SHARE) .name("twitter") .title("title1") .description("desc1") .link("https: .build(); MessageDto messageDto2 = MessageDto.builder() .type(MessageType.REFERRAL_SHARE) .name("twitter") .title("title1") .description("desc1") .link("https: .build(); MessageDto messageDto3 = MessageDto.builder() .type(MessageType.REFERRAL_SHARE) .name("twitter") .title("title1") .description("desc1") .link("https: .build(); when(githubBountyService.getVerification(principal)).thenReturn(GithubVerificationDto.builder().approved(true).build()); when(stackOverflowBountyService.getVerification(principal)).thenReturn(StackOverflowVerificationDto.builder().approved(true).build()); when(messageService.getMessageByKey("REFERRAL_SHARE.twitter")).thenReturn(messageDto1); when(messageService.getMessageByKey("REFERRAL_SHARE.linkedin")).thenReturn(messageDto2); when(messageService.getMessageByKey("REFERRAL_SHARE.facebook")).thenReturn(messageDto3); mockMvc.perform(get("/profile").principal(principal)) .andExpect(status().isOk()) .andExpect(model().attribute("isVerifiedGithub", true)) .andExpect(model().attribute("isVerifiedStackOverflow", true)) .andExpect(model().attribute("refLink", "ref")) .andExpect(model().attribute("refShareTwitter", messageDto1)) .andExpect(model().attribute("refShareLinkedin", messageDto2)) .andExpect(model().attribute("refShareFacebook", messageDto3)); }
@GetMapping("/profile") public ModelAndView showProfile(Principal principal) throws Exception { final ModelAndView mav = new ModelAndView("pages/profile/index"); mav.addObject("isVerifiedGithub", isVerifiedGithub(principal)); mav.addObject("isVerifiedStackOverflow", isVerifiedStackOverflow(principal)); mav.addObject("refLink", getRefLink(principal, "web")); mav.addObject("refShareTwitter", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.twitter"), getRefLink(principal, "twitter"))); mav.addObject("refShareLinkedin", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.linkedin"), getRefLink(principal, "linkedin"))); mav.addObject("refShareFacebook", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.facebook"), getRefLink(principal, "facebook"))); mav.addObject("arkaneWalletEndpoint", getArkaneWalletEndpoint()); return mav; }
ProfileController { @GetMapping("/profile") public ModelAndView showProfile(Principal principal) throws Exception { final ModelAndView mav = new ModelAndView("pages/profile/index"); mav.addObject("isVerifiedGithub", isVerifiedGithub(principal)); mav.addObject("isVerifiedStackOverflow", isVerifiedStackOverflow(principal)); mav.addObject("refLink", getRefLink(principal, "web")); mav.addObject("refShareTwitter", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.twitter"), getRefLink(principal, "twitter"))); mav.addObject("refShareLinkedin", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.linkedin"), getRefLink(principal, "linkedin"))); mav.addObject("refShareFacebook", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.facebook"), getRefLink(principal, "facebook"))); mav.addObject("arkaneWalletEndpoint", getArkaneWalletEndpoint()); return mav; } }
ProfileController { @GetMapping("/profile") public ModelAndView showProfile(Principal principal) throws Exception { final ModelAndView mav = new ModelAndView("pages/profile/index"); mav.addObject("isVerifiedGithub", isVerifiedGithub(principal)); mav.addObject("isVerifiedStackOverflow", isVerifiedStackOverflow(principal)); mav.addObject("refLink", getRefLink(principal, "web")); mav.addObject("refShareTwitter", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.twitter"), getRefLink(principal, "twitter"))); mav.addObject("refShareLinkedin", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.linkedin"), getRefLink(principal, "linkedin"))); mav.addObject("refShareFacebook", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.facebook"), getRefLink(principal, "facebook"))); mav.addObject("arkaneWalletEndpoint", getArkaneWalletEndpoint()); return mav; } 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 { @GetMapping("/profile") public ModelAndView showProfile(Principal principal) throws Exception { final ModelAndView mav = new ModelAndView("pages/profile/index"); mav.addObject("isVerifiedGithub", isVerifiedGithub(principal)); mav.addObject("isVerifiedStackOverflow", isVerifiedStackOverflow(principal)); mav.addObject("refLink", getRefLink(principal, "web")); mav.addObject("refShareTwitter", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.twitter"), getRefLink(principal, "twitter"))); mav.addObject("refShareLinkedin", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.linkedin"), getRefLink(principal, "linkedin"))); mav.addObject("refShareFacebook", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.facebook"), getRefLink(principal, "facebook"))); mav.addObject("arkaneWalletEndpoint", getArkaneWalletEndpoint()); return mav; } 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 { @GetMapping("/profile") public ModelAndView showProfile(Principal principal) throws Exception { final ModelAndView mav = new ModelAndView("pages/profile/index"); mav.addObject("isVerifiedGithub", isVerifiedGithub(principal)); mav.addObject("isVerifiedStackOverflow", isVerifiedStackOverflow(principal)); mav.addObject("refLink", getRefLink(principal, "web")); mav.addObject("refShareTwitter", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.twitter"), getRefLink(principal, "twitter"))); mav.addObject("refShareLinkedin", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.linkedin"), getRefLink(principal, "linkedin"))); mav.addObject("refShareFacebook", processRefLinkMessage(messageService.getMessageByKey("REFERRAL_SHARE.facebook"), getRefLink(principal, "facebook"))); mav.addObject("arkaneWalletEndpoint", getArkaneWalletEndpoint()); return mav; } 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);  }