Search in sources :

Example 1 with Pull

use of com.jcabi.github.Pull in project jcabi-github by jcabi.

the class MkPullTest method canGetCommentsNumberIfZero.

/**
 * MkPull can get comments number if no comments.
 *
 * @throws Exception when a problem occurs.
 */
@Test
public void canGetCommentsNumberIfZero() throws Exception {
    final Pull pull = MkPullTest.pullRequest();
    MatcherAssert.assertThat(pull.json().getInt("comments"), Matchers.is(0));
}
Also used : Pull(com.jcabi.github.Pull) Test(org.junit.Test)

Example 2 with Pull

use of com.jcabi.github.Pull in project jcabi-github by jcabi.

the class MkPullTest method canPatchJson.

/**
 * MkPull can perform JSON patch operation.
 *
 * @throws Exception If a problem occurs.
 */
@Test
public void canPatchJson() throws Exception {
    final Pull pull = MkPullTest.repo().pulls().create("Test Patch", "def", "abc");
    final String value = "someValue";
    pull.patch(Json.createObjectBuilder().add("patch", value).build());
    MatcherAssert.assertThat(pull.json().getString("patch"), Matchers.equalTo(value));
}
Also used : Pull(com.jcabi.github.Pull) Test(org.junit.Test)

Example 3 with Pull

use of com.jcabi.github.Pull in project jcabi-github by jcabi.

the class MkPullTest method canGetCommentsNumberIfNonZero.

/**
 * MkPull can get comments number if some comments exist.
 *
 * @throws Exception when a problem occurs.
 */
@Test
public void canGetCommentsNumberIfNonZero() throws Exception {
    final Pull pull = MkPullTest.pullRequest();
    pull.comments().post("comment1", "path1", "how are you?", 1);
    pull.comments().post("comment2", "path2", "how are you2?", 2);
    MatcherAssert.assertThat(pull.json().getInt("comments"), Matchers.is(2));
}
Also used : Pull(com.jcabi.github.Pull) Test(org.junit.Test)

Example 4 with Pull

use of com.jcabi.github.Pull in project jcabi-github by jcabi.

the class MkPullTest method canGetComments.

/**
 * MkPull can get comments.
 *
 * @throws Exception when a problem occurs.
 */
@Test
public void canGetComments() throws Exception {
    final Pull pull = MkPullTest.pullRequest();
    MatcherAssert.assertThat(pull.comments(), Matchers.notNullValue());
}
Also used : Pull(com.jcabi.github.Pull) Test(org.junit.Test)

Example 5 with Pull

use of com.jcabi.github.Pull in project jcabi-github by jcabi.

the class MkPullTest method canRetrieveAsJson.

/**
 * MkPull can be represented as JSON.
 *
 * @throws Exception If a problem occurs.
 */
@Test
public void canRetrieveAsJson() throws Exception {
    final String head = "blah";
    final String base = "aaa";
    final Pull pull = MkPullTest.repo().pulls().create("Test Pull Json", head, base);
    final JsonObject json = pull.json();
    MatcherAssert.assertThat(json.getInt("number"), Matchers.equalTo(1));
    MatcherAssert.assertThat(json.getJsonObject("head").getString("label"), Matchers.equalTo(String.format("%s:%s", MkPullTest.USERNAME, head)));
    MatcherAssert.assertThat(json.getJsonObject("base").getString("label"), Matchers.equalTo(String.format("%s:%s", MkPullTest.USERNAME, base)));
    MatcherAssert.assertThat(json.getJsonObject("user").getString("login"), Matchers.equalTo(MkPullTest.USERNAME));
}
Also used : Pull(com.jcabi.github.Pull) JsonObject(javax.json.JsonObject) Test(org.junit.Test)

Aggregations

Pull (com.jcabi.github.Pull)7 Test (org.junit.Test)7 Issue (com.jcabi.github.Issue)1 Repo (com.jcabi.github.Repo)1 JsonObject (javax.json.JsonObject)1