Search in sources :

Example 36 with FakeRequest

use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.

the class RtIssueTest method fetchesLabels.

/**
 * RtIssue should be able to fetch its labels.
 *
 * @throws Exception if a problem occurs.
 */
@Test
public void fetchesLabels() throws Exception {
    final RtIssue issue = new RtIssue(new FakeRequest(), this.repo(), 1);
    MatcherAssert.assertThat(issue.labels(), Matchers.notNullValue());
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 37 with FakeRequest

use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.

the class RtBranchesTest method fetchesRepo.

/**
 * RtBranches can fetch its repository.
 * @throws IOException If there is any I/O problem
 */
@Test
public void fetchesRepo() throws IOException {
    final Repo repo = new MkGithub().randomRepo();
    final RtBranches branch = new RtBranches(new FakeRequest(), repo);
    final Coordinates coords = branch.repo().coordinates();
    MatcherAssert.assertThat(coords.user(), Matchers.equalTo(repo.coordinates().user()));
    MatcherAssert.assertThat(coords.repo(), Matchers.equalTo(repo.coordinates().repo()));
}
Also used : MkGithub(com.jcabi.github.mock.MkGithub) FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 38 with FakeRequest

use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.

the class RtCommentTest method returnsItsIssue.

/**
 * RtComment can return its issue (owner).
 * @throws Exception - if anything goes wrong.
 */
@Test
public void returnsItsIssue() throws Exception {
    final Repo repo = new MkGithub().randomRepo();
    final Issue issue = repo.issues().create("testing1", "issue1");
    final RtComment comment = new RtComment(new FakeRequest(), issue, 1);
    MatcherAssert.assertThat(comment.issue(), Matchers.is(issue));
}
Also used : MkGithub(com.jcabi.github.mock.MkGithub) FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 39 with FakeRequest

use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.

the class RtCommentTest method returnsItsNumber.

/**
 * RtComment can return its number.
 * @throws Exception - in case something goes wrong.
 */
@Test
public void returnsItsNumber() throws Exception {
    final Repo repo = new MkGithub().randomRepo();
    final Issue issue = repo.issues().create("testing2", "issue2");
    final int num = 10;
    final RtComment comment = new RtComment(new FakeRequest(), issue, num);
    MatcherAssert.assertThat(comment.number(), Matchers.is(num));
}
Also used : MkGithub(com.jcabi.github.mock.MkGithub) FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 40 with FakeRequest

use of com.jcabi.http.request.FakeRequest in project jcabi-github by jcabi.

the class RtEventTest method canRetrieveOwnNumber.

/**
 * RtEvent can retrieve its own number.
 *
 * @throws Exception if a problem occurs.
 */
@Test
public void canRetrieveOwnNumber() throws Exception {
    final Repo repo = this.repo();
    final RtEvent event = new RtEvent(new FakeRequest(), repo, 2);
    MatcherAssert.assertThat(event.number(), Matchers.equalTo(2));
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Aggregations

FakeRequest (com.jcabi.http.request.FakeRequest)65 Test (org.junit.Test)65 MkGithub (com.jcabi.github.mock.MkGithub)9 JsonObject (javax.json.JsonObject)3 Request (com.jcabi.http.Request)2 ApacheRequest (com.jcabi.http.request.ApacheRequest)2 MkOrganization (com.jcabi.github.mock.MkOrganization)1 Response (com.jcabi.http.Response)1 MkContainer (com.jcabi.http.mock.MkContainer)1 MkGrizzlyContainer (com.jcabi.http.mock.MkGrizzlyContainer)1 JsonResponse (com.jcabi.http.response.JsonResponse)1