use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkIssuesTest method iteratesIssues.
/**
* MkIssues can list issues.
* @throws Exception If some problem inside
*/
@Test
public void iteratesIssues() throws Exception {
final Repo repo = new MkGithub().randomRepo();
repo.issues().create("hey, you", "body of issue");
repo.issues().create("hey", "body of 2nd issue");
repo.issues().create("hey again", "body of 3rd issue");
MatcherAssert.assertThat(repo.issues().iterate(new ArrayMap<String, String>()), Matchers.<Issue>iterableWithSize(Tv.THREE));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkIssuesTest method createsMultipleIssues.
/**
* MkIssues can create a multiple issues.
* @throws Exception If some problem inside
*/
@Test
public void createsMultipleIssues() throws Exception {
final Github github = new MkGithub("jeff");
final Repo repo = github.repos().create(new Repos.RepoCreate("test-3", false));
for (int idx = 1; idx < Tv.TEN; ++idx) {
repo.issues().create("title", "body");
}
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkIssuesTest method createsNewIssueWithCorrectAuthor.
/**
* MkIssues can create a new issue with correct author.
* @throws Exception If some problem inside
*/
@Test
public void createsNewIssueWithCorrectAuthor() throws Exception {
final Repo repo = new MkGithub().randomRepo();
final Issue.Smart issue = new Issue.Smart(repo.issues().create("hello", "the body"));
MatcherAssert.assertThat(issue.author().login(), Matchers.equalTo(repo.github().users().self().login()));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkMilestoneTest method returnsSameCoordinatesRepo.
/**
* MkMilestone returns a repo with same coordinates.
* @throws Exception if test fails
*/
@Test
public final void returnsSameCoordinatesRepo() throws Exception {
final Coordinates coordinates = new Coordinates.Simple("user", "repo");
final MkMilestone milestone = new MkMilestone(new MkStorage.InFile(), "login", coordinates, 1);
final Repo repo = milestone.repo();
MatcherAssert.assertThat(repo.coordinates(), Matchers.equalTo(coordinates));
}
use of com.jcabi.github.Repo in project jcabi-github by jcabi.
the class MkPullCommentsTest method postsPullComment.
/**
* MkPullComments can create a pull comment.
*
* @throws Exception If something goes wrong.
*/
@Test
public void postsPullComment() throws Exception {
final MkStorage storage = new MkStorage.InFile();
final String commit = "commit_id";
final String path = "path";
final String bodytext = "some text as a body";
final String login = "jamie";
final String reponame = "incredible";
final Repo repo = new MkGithub(storage, login).repos().create(new Repos.RepoCreate(reponame, false));
repo.pulls().create("pullrequest1", "head", "base").comments().post(bodytext, commit, path, 1);
final String[] fields = { commit, path };
for (final String element : fields) {
MkPullCommentsTest.assertFieldContains(storage, repo, element);
}
final List<String> position = storage.xml().xpath(String.format(// @checkstyle LineLength (1 line)
"/github/repos/repo[@coords='%s/%s']/pulls/pull/comments/comment/position/text()", repo.coordinates().user(), repo.coordinates().repo()));
MatcherAssert.assertThat(position.get(0), Matchers.notNullValue());
final List<String> body = storage.xml().xpath(String.format(// @checkstyle LineLength (1 line)
"/github/repos/repo[@coords='%s/%s']/pulls/pull/comments/comment/body/text()", repo.coordinates().user(), repo.coordinates().repo()));
MatcherAssert.assertThat(body.get(0), Matchers.equalTo(bodytext));
}
Aggregations