public PullRequestCommentProducer(GitHubEndpoint endpoint) throws Exception {
        super(endpoint);

        Registry registry = endpoint.getCamelContext().getRegistry();
        Object service = registry.lookupByName(GitHubConstants.GITHUB_PULL_REQUEST_SERVICE);
        if (service != null) {
            LOG.debug("Using PullRequestService found in registry {}", service.getClass().getCanonicalName());
            pullRequestService = (PullRequestService) service;
        } else {
            pullRequestService = new PullRequestService();
        }
        initService(pullRequestService);

        service = registry.lookupByName("githbIssueService");
        if (service != null) {
            issueService = (IssueService) service;
        } else {
            issueService = new IssueService();
        }
        initService(issueService);
    }
@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(Long.toString(pullRequest.getId()), commitComment.getCommitId(), "Commit IDs did not match");
        assertEquals(commentText, commitComment.getBodyText(), "Comment text did not match");
    }