Search in sources :

Example 16 with FakeRequest

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

the class RtRepoTest method fetchesGit.

/**
 * RtRepo can fetch Git.
 */
@Test
public void fetchesGit() {
    final Repo repo = RtRepoTest.repo(new FakeRequest());
    MatcherAssert.assertThat(repo.git(), Matchers.notNullValue());
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 17 with FakeRequest

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

the class RtRepoTest method identifiesItself.

/**
 * RtRepo can identify itself.
 * @throws Exception If some problem inside
 */
@Test
public void identifiesItself() throws Exception {
    final Coordinates coords = new Coordinates.Simple("me", "me-branch");
    final Repo repo = new RtRepo(Mockito.mock(Github.class), new FakeRequest(), coords);
    MatcherAssert.assertThat(repo.coordinates(), Matchers.sameInstance(coords));
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 18 with FakeRequest

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

the class RtOrganizationTest method canFetchIssueAsJson.

/**
 * RtOrganization should be able to describe itself in JSON format.
 *
 * @throws Exception if a problem occurs.
 */
@Test
public void canFetchIssueAsJson() throws Exception {
    final RtOrganization org = new RtOrganization(new MkGithub(), new FakeRequest().withBody("{\"organization\":\"json\"}"), "testJson");
    MatcherAssert.assertThat(org.json().getString("organization"), Matchers.equalTo("json"));
}
Also used : MkGithub(com.jcabi.github.mock.MkGithub) FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 19 with FakeRequest

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

the class RtPullTest method canCompareInstances.

/**
 * RtPull should be able to compare different instances.
 *
 * @throws Exception when a problem occurs.
 */
@Test
public void canCompareInstances() throws Exception {
    final RtPull less = new RtPull(new FakeRequest(), this.repo(), 1);
    final RtPull greater = new RtPull(new FakeRequest(), this.repo(), 2);
    MatcherAssert.assertThat(less.compareTo(greater), Matchers.lessThan(0));
    MatcherAssert.assertThat(greater.compareTo(less), Matchers.greaterThan(0));
}
Also used : FakeRequest(com.jcabi.http.request.FakeRequest) Test(org.junit.Test)

Example 20 with FakeRequest

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

the class RtStatusesTest method fetchesCommit.

/**
 * RtStatuses can fetch its commit.
 * @throws IOException If there is an I/O problem.
 */
@Test
public void fetchesCommit() throws IOException {
    final Commit original = new MkGithub().randomRepo().git().commits().get("5e8d65e0dbfab0716db16493e03a0baba480625a");
    MatcherAssert.assertThat(new RtStatuses(new FakeRequest(), original).commit(), Matchers.equalTo(original));
}
Also used : MkGithub(com.jcabi.github.mock.MkGithub) 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