}
@Test
public void testPullRequestCommentProducer() throws Exception {
PullRequest pullRequest = pullRequestService.addPullRequest("testPullRequestCommentProducer");
latestPullRequestId = pullRequest.getId();
Endpoint commentProducerEndpoint = getMandatoryEndpoint("direct:validPullRequest");
Exchange exchange = commentProducerEndpoint.createExchange();
String commentText = "Pushed this comment at " + new Date();
exchange.getIn().setBody(commentText);
template.send(commentProducerEndpoint, exchange);
Thread.sleep(1 * 1000);
// Verify that the mock pull request service received this comment.
List<CommitComment> commitComments = pullRequestService.getComments(null, (int) pullRequest.getId());
assertEquals(1, commitComments.size());
CommitComment commitComment = commitComments.get(0);
assertEquals("Commit IDs did not match ", Long.toString(pullRequest.getId()), commitComment.getCommitId());
assertEquals("Comment text did not match ", commentText, commitComment.getBodyText());
}