@Test public void postsGithubComment_noSolverFound() { final RequestClaimedEvent event = RequestClaimedEvent.builder() .blockchainEventId(1324354L) .requestDto(RequestDtoMother.freeCodeCampNoUserStories()) .claimDto(mock(ClaimDto.class)) .solver(SOLVER) .timestamp(LocalDateTime.now()) .build(); final RequestDto request = event.getRequestDto(); final IssueInformationDto issueInformation = request.getIssueInformation(); when(githubScraper.fetchGithubIssue(issueInformation.getOwner(), issueInformation.getRepo(), issueInformation.getNumber())).thenReturn(GithubIssue.builder().build()); try { handler.createGithubCommentOnRequestClaimed(event); fail("RuntimeException expected"); } catch (RuntimeException e) { assertThat(e.getMessage()).isEqualTo("No solver found for request " + request.getId()); } }
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) public void createGithubCommentOnRequestClaimed(final RequestClaimedEvent event) { if (addComment) { final RequestDto request = event.getRequestDto(); final IssueInformationDto issueInformation = request.getIssueInformation(); final ClaimDto claim = event.getClaimDto(); if (issueInformation.getPlatform() == Platform.GITHUB) { placeComment(request, issueInformation, claim); } } }
CreateGithubCommentOnClosedHandler { @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) public void createGithubCommentOnRequestClaimed(final RequestClaimedEvent event) { if (addComment) { final RequestDto request = event.getRequestDto(); final IssueInformationDto issueInformation = request.getIssueInformation(); final ClaimDto claim = event.getClaimDto(); if (issueInformation.getPlatform() == Platform.GITHUB) { placeComment(request, issueInformation, claim); } } } }
CreateGithubCommentOnClosedHandler { @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) public void createGithubCommentOnRequestClaimed(final RequestClaimedEvent event) { if (addComment) { final RequestDto request = event.getRequestDto(); final IssueInformationDto issueInformation = request.getIssueInformation(); final ClaimDto claim = event.getClaimDto(); if (issueInformation.getPlatform() == Platform.GITHUB) { placeComment(request, issueInformation, claim); } } } CreateGithubCommentOnClosedHandler(final GithubGateway githubGateway,
                                              final GithubScraper githubScraper,
                                              final GithubCommentFactory githubCommentFactory,
                                              @Value("${github.add-comments:false}") final Boolean addComment,
                                              @Value("${feign.client.github.username:fundrequest-notifier}") final String githubUser); }
CreateGithubCommentOnClosedHandler { @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) public void createGithubCommentOnRequestClaimed(final RequestClaimedEvent event) { if (addComment) { final RequestDto request = event.getRequestDto(); final IssueInformationDto issueInformation = request.getIssueInformation(); final ClaimDto claim = event.getClaimDto(); if (issueInformation.getPlatform() == Platform.GITHUB) { placeComment(request, issueInformation, claim); } } } CreateGithubCommentOnClosedHandler(final GithubGateway githubGateway,
                                              final GithubScraper githubScraper,
                                              final GithubCommentFactory githubCommentFactory,
                                              @Value("${github.add-comments:false}") final Boolean addComment,
                                              @Value("${feign.client.github.username:fundrequest-notifier}") final String githubUser); @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) void createGithubCommentOnRequestClaimed(final RequestClaimedEvent event); }
CreateGithubCommentOnClosedHandler { @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) public void createGithubCommentOnRequestClaimed(final RequestClaimedEvent event) { if (addComment) { final RequestDto request = event.getRequestDto(); final IssueInformationDto issueInformation = request.getIssueInformation(); final ClaimDto claim = event.getClaimDto(); if (issueInformation.getPlatform() == Platform.GITHUB) { placeComment(request, issueInformation, claim); } } } CreateGithubCommentOnClosedHandler(final GithubGateway githubGateway,
                                              final GithubScraper githubScraper,
                                              final GithubCommentFactory githubCommentFactory,
                                              @Value("${github.add-comments:false}") final Boolean addComment,
                                              @Value("${feign.client.github.username:fundrequest-notifier}") final String githubUser); @TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT) void createGithubCommentOnRequestClaimed(final RequestClaimedEvent event);  }