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));
}
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));
}
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));
}
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());
}
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));
}
Aggregations