@Test public void handle() { long fundId = 243L; long requestId = 764L; final String message = "ewfegdbf"; final RequestFundedNotificationDto notification = RequestFundedNotificationDto.builder().fundId(fundId).requestId(requestId).build(); final TokenValueDto tokenValue = TokenValueDtoMother.FND().build(); final FundDto fund = FundDto.builder().tokenValue(tokenValue).build(); final Context context = new Context(); context.setVariable("platformBasePath", platformBasePath); context.setVariable("fund", fund); when(fundService.findOne(fundId)).thenReturn(fund); when(githubTemplateEngine.process(eq("notification-templates/request-funded-tweet"), refEq(context, "locale"))).thenReturn(message); handler.handle(notification); verify(twitter.timelineOperations()).updateStatus(message); }
@EventListener @Async("taskExecutor") @Transactional(readOnly = true, propagation = REQUIRES_NEW) public void handle(final RequestFundedNotificationDto notification) { final FundDto fund = fundService.findOne(notification.getFundId()); Context context = new Context(); context.setVariable("platformBasePath", platformBasePath); context.setVariable("fund", fund); final String message = githubTemplateEngine.process("notification-templates/request-funded-tweet", context); tweetOnFundTwitterTemplate.timelineOperations().updateStatus(message); }
TweetRequestFundedHandler { @EventListener @Async("taskExecutor") @Transactional(readOnly = true, propagation = REQUIRES_NEW) public void handle(final RequestFundedNotificationDto notification) { final FundDto fund = fundService.findOne(notification.getFundId()); Context context = new Context(); context.setVariable("platformBasePath", platformBasePath); context.setVariable("fund", fund); final String message = githubTemplateEngine.process("notification-templates/request-funded-tweet", context); tweetOnFundTwitterTemplate.timelineOperations().updateStatus(message); } }
TweetRequestFundedHandler { @EventListener @Async("taskExecutor") @Transactional(readOnly = true, propagation = REQUIRES_NEW) public void handle(final RequestFundedNotificationDto notification) { final FundDto fund = fundService.findOne(notification.getFundId()); Context context = new Context(); context.setVariable("platformBasePath", platformBasePath); context.setVariable("fund", fund); final String message = githubTemplateEngine.process("notification-templates/request-funded-tweet", context); tweetOnFundTwitterTemplate.timelineOperations().updateStatus(message); } TweetRequestFundedHandler(final Twitter tweetOnFundTwitterTemplate,
                                     final ITemplateEngine githubTemplateEngine,
                                     final FundService fundService,
                                     @Value("${io.fundrequest.platform.base-path}") final String platformBasePath); }
TweetRequestFundedHandler { @EventListener @Async("taskExecutor") @Transactional(readOnly = true, propagation = REQUIRES_NEW) public void handle(final RequestFundedNotificationDto notification) { final FundDto fund = fundService.findOne(notification.getFundId()); Context context = new Context(); context.setVariable("platformBasePath", platformBasePath); context.setVariable("fund", fund); final String message = githubTemplateEngine.process("notification-templates/request-funded-tweet", context); tweetOnFundTwitterTemplate.timelineOperations().updateStatus(message); } TweetRequestFundedHandler(final Twitter tweetOnFundTwitterTemplate,
                                     final ITemplateEngine githubTemplateEngine,
                                     final FundService fundService,
                                     @Value("${io.fundrequest.platform.base-path}") final String platformBasePath); @EventListener @Async("taskExecutor") @Transactional(readOnly = true, propagation = REQUIRES_NEW) void handle(final RequestFundedNotificationDto notification); }
TweetRequestFundedHandler { @EventListener @Async("taskExecutor") @Transactional(readOnly = true, propagation = REQUIRES_NEW) public void handle(final RequestFundedNotificationDto notification) { final FundDto fund = fundService.findOne(notification.getFundId()); Context context = new Context(); context.setVariable("platformBasePath", platformBasePath); context.setVariable("fund", fund); final String message = githubTemplateEngine.process("notification-templates/request-funded-tweet", context); tweetOnFundTwitterTemplate.timelineOperations().updateStatus(message); } TweetRequestFundedHandler(final Twitter tweetOnFundTwitterTemplate,
                                     final ITemplateEngine githubTemplateEngine,
                                     final FundService fundService,
                                     @Value("${io.fundrequest.platform.base-path}") final String platformBasePath); @EventListener @Async("taskExecutor") @Transactional(readOnly = true, propagation = REQUIRES_NEW) void handle(final RequestFundedNotificationDto notification);  }