@@ -0,0 +1,3669 @@
+package io.fundreqest.platform.tweb.profile;%0A%0Aimport io.fundreqest.platform.tweb.infrastructure.AbstractControllerTest;%0Aimport io.fundrequest.platform.profile.github.GithubBountyService;%0Aimport io.fundrequest.platform.profile.profile.ProfileService;%0Aimport io.fundrequest.platform.profile.profile.dto.GithubVerificationDto;%0Aimport io.fundrequest.platform.profile.ref.RefSignupEvent;%0Aimport io.fundrequest.platform.profile.ref.ReferralService;%0Aimport io.fundrequest.platform.profile.stackoverflow.StackOverflowBountyService;%0Aimport io.fundrequest.platform.profile.stackoverflow.dto.StackOverflowVerificationDto;%0Aimport org.junit.jupiter.api.Test;%0Aimport org.springframework.context.ApplicationEventPublisher;%0A%0Aimport java.security.Principal;%0A%0Aimport static org.mockito.Matchers.anyString;%0Aimport static org.mockito.Matchers.eq;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0Aimport static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrl;%0Aimport static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;%0A%0Apublic class ProfileControllerTest extends AbstractControllerTest%3CProfileController%3E %7B%0A%0A    private ReferralService referralService;%0A    private Principal principal;%0A    private GithubBountyService githubBountyService;%0A    private StackOverflowBountyService stackOverflowBountyService;%0A    private ApplicationEventPublisher eventPublisher;%0A%0A    @Override%0A    protected ProfileController setupController() %7B%0A        principal = () -%3E %22davyvanroy%22;%0A        referralService = mock(ReferralService.class);%0A        when(referralService.generateRefLink(eq(principal.getName()), anyString())).thenReturn(%22ref%22);%0A        githubBountyService = mock(GithubBountyService.class);%0A        stackOverflowBountyService = mock(StackOverflowBountyService.class);%0A        eventPublisher = mock(ApplicationEventPublisher.class);%0A        return new ProfileController(%0A                eventPublisher,%0A                mock(ProfileService.class),%0A                referralService,%0A                githubBountyService,%0A                stackOverflowBountyService%0A        );%0A    %7D%0A%0A    @Test%0A    void showProfile() throws Exception %7B%0A        when(githubBountyService.getVerification(principal)).thenReturn(GithubVerificationDto.builder().approved(true).build());%0A        when(stackOverflowBountyService.getVerification(principal)).thenReturn(StackOverflowVerificationDto.builder().approved(true).build());%0A%0A%0A        mockMvc.perform(get(%22/profile%22).principal(principal))%0A               .andExpect(status().isOk())%0A               .andExpect(model().attribute(%22isVerifiedGithub%22, true))%0A               .andExpect(model().attribute(%22isVerifiedStackOverflow%22, true))%0A               .andExpect(model().attribute(%22refLink%22, %22ref%22))%0A               .andExpect(model().attribute(%22refLinkTwitter%22, %22ref%22))%0A               .andExpect(model().attribute(%22refLinkLinkedin%22, %22ref%22))%0A               .andExpect(model().attribute(%22refLinkFacebook%22, %22ref%22));%0A    %7D%0A%0A    @Test%0A    void showProfileEmitsEventWhenRefPresent() throws Exception %7B%0A        String ref = %22ref%22;%0A%0A        mockMvc.perform(get(%22/profile?ref=ref%22).principal(principal))%0A               .andExpect(status().is3xxRedirection())%0A               .andExpect(redirectedUrl(%22/profile%22));%0A%0A        RefSignupEvent expected = RefSignupEvent.builder().principal(principal).ref(ref).build();%0A        verify(eventPublisher).publishEvent(expected);%0A    %7D%0A%7D

add test