use of com.jcabi.http.request.JdkRequest in project jcabi-github by jcabi.
the class RtPullCommentsTest method iteratesRepoPullComments.
/**
* RtPullComments can fetch all pull comments for a repo.
*
* @throws Exception If something goes wrong.
*/
@Test
public void iteratesRepoPullComments() throws Exception {
final Pull pull = Mockito.mock(Pull.class);
Mockito.doReturn(repo()).when(pull).repo();
final MkContainer container = new MkGrizzlyContainer().next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, Json.createArrayBuilder().add(comment("comment 1")).add(comment("comment 2")).build().toString())).start(this.resource.port());
try {
final RtPullComments comments = new RtPullComments(new JdkRequest(container.home()), pull);
MatcherAssert.assertThat(comments.iterate(Collections.<String, String>emptyMap()), Matchers.<PullComment>iterableWithSize(2));
} finally {
container.stop();
}
}
use of com.jcabi.http.request.JdkRequest in project jcabi-github by jcabi.
the class RtPullCommentsTest method iteratesPullRequestComments.
/**
* RtPullComments can fetch pull comments for a pull request.
*
* @throws Exception If something goes wrong.
*/
@Test
public void iteratesPullRequestComments() throws Exception {
final Pull pull = Mockito.mock(Pull.class);
Mockito.doReturn(repo()).when(pull).repo();
final MkContainer container = new MkGrizzlyContainer().next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, Json.createArrayBuilder().add(comment("comment 3")).add(comment("comment 4")).build().toString())).start(this.resource.port());
try {
final RtPullComments comments = new RtPullComments(new JdkRequest(container.home()), pull);
MatcherAssert.assertThat(comments.iterate(1, Collections.<String, String>emptyMap()), Matchers.<PullComment>iterableWithSize(2));
} finally {
container.stop();
}
}
Aggregations