### Question:
GithubBountyServiceImpl implements GithubBountyService, ApplicationListener<AuthenticationSuccessEvent> { @Override @Transactional public void onApplicationEvent(AuthenticationSuccessEvent event) { Authentication principal = event.getAuthentication(); UserProfile userProfile = profileService.getUserProfile(principal); if (userProfile.getGithub() != null && StringUtils.isNotBlank(userProfile.getGithub().getUserId())) { createBountyWhenNecessary(principal, userProfile); } } GithubBountyServiceImpl(ProfileService profileService,
                                   GithubBountyRepository githubBountyRepository,
                                   BountyService bountyService,
                                   GithubGateway githubGateway,
                                   ApplicationEventPublisher eventPublisher); @EventListener @Transactional void onProviderLinked(UserLinkedProviderEvent event); @Override @Transactional void onApplicationEvent(AuthenticationSuccessEvent event); @Override @Transactional(readOnly = true) GithubVerificationDto getVerification(Principal principal);  }### Answer:
@Test public void onAuthenticationChecksGithubSignup() { Authentication authentication = mock(Authentication.class, RETURNS_DEEP_STUBS); when(authentication.getName()).thenReturn("davy"); when(profileService.getUserProfile(authentication)) .thenReturn(UserProfile.builder().github(UserProfileProvider.builder().userId("id").username("davy").build()).verifiedDeveloper(true).build()); when(githubGateway.getUser("davy")).thenReturn(GithubUser.builder().createdAt(LocalDateTime.of(2017, 1, 1, 1, 1)).location("Belgium").build()); githubBountyService.onApplicationEvent(new AuthenticationSuccessEvent(authentication)); verifyBountiesSaved(); }