final String body = "test-body";
final String commit = "test-commit-id";
final String path = "test-path";
final int position = 4;
final String response = pulls(body, commit, path, position).toString();
final MkContainer container = new MkGrizzlyContainer().next(
new MkAnswer.Simple(HttpURLConnection.HTTP_CREATED, response)
).next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, response))
.start();
final Pull pull = Mockito.mock(Pull.class);
Mockito.doReturn(repo()).when(pull).repo();
final RtPullComments pullComments = new RtPullComments(
new ApacheRequest(container.home()),
pull
);
try {
final PullComment pullComment = pullComments.post(
body, commit, path, position
);
MatcherAssert.assertThat(
container.take().method(),
Matchers.equalTo(Request.POST)
);
MatcherAssert.assertThat(
new PullComment.Smart(pullComment).commitId(),
Matchers.equalTo(commit)
);
} finally {
container.stop();
}
}