use of com.jcabi.http.request.JdkRequest in project jcabi-github by jcabi.
the class RtIssuesTest method getSingleIssue.
/**
* RtIssues can get a single issue.
* @throws Exception if some problem inside
*/
@Test
public void getSingleIssue() throws Exception {
final String title = "Unit test";
final MkContainer container = new MkGrizzlyContainer().next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, issue(title).toString())).start(this.resource.port());
final RtIssues issues = new RtIssues(new JdkRequest(container.home()), repo());
final Issue issue = issues.get(1);
MatcherAssert.assertThat(new Issue.Smart(issue).title(), Matchers.equalTo(title));
container.stop();
}
use of com.jcabi.http.request.JdkRequest in project jcabi-github by jcabi.
the class RtCollaboratorsTest method canIterate.
/**
* RtCollaborators can iterate over a list of collaborators.
* @throws Exception if any error occurs.
*/
@Test
public void canIterate() throws Exception {
final MkContainer container = new MkGrizzlyContainer().next(new MkAnswer.Simple(HttpURLConnection.HTTP_OK, Json.createArrayBuilder().add(RtCollaboratorsTest.json("octocat")).add(RtCollaboratorsTest.json("dummy")).build().toString())).start(this.resource.port());
final Collaborators users = new RtCollaborators(new JdkRequest(container.home()), this.repo());
MatcherAssert.assertThat(users.iterate(), Matchers.<User>iterableWithSize(2));
container.stop();
}
use of com.jcabi.http.request.JdkRequest in project jcabi-github by jcabi.
the class RtCollaboratorsTest method userCanBeRemoved.
/**
* User can be removed from a list of collaborators.
* @throws Exception if any error occurs.
*/
@Test
public void userCanBeRemoved() throws Exception {
final MkContainer container = new MkGrizzlyContainer().next(new MkAnswer.Simple(HttpURLConnection.HTTP_NO_CONTENT, Json.createArrayBuilder().add(RtCollaboratorsTest.json("octocat2")).add(RtCollaboratorsTest.json("dummy")).build().toString())).start(this.resource.port());
final Collaborators users = new RtCollaborators(new JdkRequest(container.home()), this.repo());
try {
users.remove("dummy");
final MkQuery query = container.take();
MatcherAssert.assertThat(query.method(), Matchers.equalTo(Request.DELETE));
} finally {
container.stop();
}
}
use of com.jcabi.http.request.JdkRequest in project jcabi-github by jcabi.
the class RtCollaboratorsTest method userCanBeTestForBeingCollaborator.
/**
* User can be checked for being a collaborator.
* @throws Exception if any error occurs.
*/
@Test
public void userCanBeTestForBeingCollaborator() throws Exception {
final MkContainer container = new MkGrizzlyContainer().next(new MkAnswer.Simple(HttpURLConnection.HTTP_NO_CONTENT, Json.createArrayBuilder().add(RtCollaboratorsTest.json("octocat2")).add(RtCollaboratorsTest.json("dummy")).build().toString())).start(this.resource.port());
final Collaborators users = new RtCollaborators(new JdkRequest(container.home()), this.repo());
try {
MatcherAssert.assertThat(users.isCollaborator("octocat2"), Matchers.equalTo(true));
} finally {
container.stop();
}
}
use of com.jcabi.http.request.JdkRequest in project jcabi-github by jcabi.
the class RtAssigneesTest method checkUserIsAssigneeForRepo.
/**
* RtAssignees can check if user is assignee for this repo.
* @throws Exception Exception If some problem inside
*/
@Test
public void checkUserIsAssigneeForRepo() throws Exception {
final MkContainer container = new MkGrizzlyContainer().next(new MkAnswer.Simple(HttpURLConnection.HTTP_NO_CONTENT, Json.createArrayBuilder().add(RtAssigneesTest.json("octocat2")).add(RtAssigneesTest.json("dummy")).build().toString())).start(this.resource.port());
final Assignees users = new RtAssignees(new JdkRequest(container.home()), this.repo());
MatcherAssert.assertThat(users.check("octocat2"), Matchers.equalTo(true));
container.stop();
}
Aggregations