Search in sources :

Example 16 with Repo

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

the class MkIssueLabelsTest method addingLabelGeneratesEvent.

/**
 * MkIssueLabels creates a "labeled" event when a label is added.
 * @throws Exception If some problem inside
 */
@Test
public void addingLabelGeneratesEvent() throws Exception {
    final Repo repo = new MkGithub().randomRepo();
    final String name = "confirmed";
    repo.labels().create(name, "663399");
    final Issue issue = repo.issues().create("Titular", "Corpus");
    issue.labels().add(Collections.singletonList(name));
    MatcherAssert.assertThat(issue.events(), Matchers.<Event>iterableWithSize(1));
    final Event.Smart labeled = new Event.Smart(issue.events().iterator().next());
    MatcherAssert.assertThat(labeled.type(), Matchers.equalTo(Event.LABELED));
    MatcherAssert.assertThat(labeled.author().login(), Matchers.equalTo(USER));
    MatcherAssert.assertThat(labeled.repo(), Matchers.equalTo(repo));
    MatcherAssert.assertThat(labeled.label().get().name(), Matchers.equalTo(name));
}
Also used : Issue(com.jcabi.github.Issue) Repo(com.jcabi.github.Repo) Event(com.jcabi.github.Event) Test(org.junit.Test)

Example 17 with Repo

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

the class MkIssueLabelsTest method createsLabelsThroughDecorator.

/**
 * MkIssueLabels can create labels through Smart decorator.
 * @throws Exception If some problem inside
 */
@Test
public void createsLabelsThroughDecorator() throws Exception {
    final Repo repo = new MkGithub().randomRepo();
    final Issue issue = repo.issues().create("how are you?", "");
    final String name = "task";
    new IssueLabels.Smart(issue.labels()).addIfAbsent(name, "f0f0f0");
    MatcherAssert.assertThat(issue.labels().iterate(), Matchers.<Label>iterableWithSize(1));
}
Also used : Issue(com.jcabi.github.Issue) Repo(com.jcabi.github.Repo) IssueLabels(com.jcabi.github.IssueLabels) Test(org.junit.Test)

Example 18 with Repo

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

the class MkMilestonesTest method returnsRepo.

/**
 * This tests that MkMilestones can return its owner repo.
 * @throws Exception - if something goes wrong.
 */
@Test
public void returnsRepo() throws Exception {
    final Repo repo = new MkGithub().randomRepo();
    final Repo owner = repo.milestones().repo();
    MatcherAssert.assertThat(repo, Matchers.is(owner));
}
Also used : Repo(com.jcabi.github.Repo) Test(org.junit.Test)

Example 19 with Repo

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

the class MkReferencesTest method removesReference.

/**
 * MkReferences can remove a Reference.
 * @throws Exception - If something goes wrong.
 */
@Test
public void removesReference() throws Exception {
    final Repo owner = new MkGithub().randomRepo();
    final References refs = owner.git().references();
    refs.create("refs/heads/testbr", "qweqwe22");
    refs.create("refs/tags/t2", "111teee");
    MatcherAssert.assertThat(refs.iterate(), Matchers.<Reference>iterableWithSize(2));
    refs.remove("refs/tags/t2");
    MatcherAssert.assertThat(refs.iterate(), Matchers.<Reference>iterableWithSize(1));
}
Also used : Repo(com.jcabi.github.Repo) References(com.jcabi.github.References) Test(org.junit.Test)

Example 20 with Repo

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

the class MkReferencesTest method iteratesReferences.

/**
 * MkReferences can iterate over references.
 * @throws Exception - If something goes wrong.
 */
@Test
public void iteratesReferences() throws Exception {
    final Repo owner = new MkGithub().randomRepo();
    final References refs = owner.git().references();
    refs.create("refs/heads/br", "qweqwe");
    refs.create("refs/tags/t1", "111t222");
    MatcherAssert.assertThat(refs.iterate(), Matchers.<Reference>iterableWithSize(2));
}
Also used : Repo(com.jcabi.github.Repo) References(com.jcabi.github.References) Test(org.junit.Test)

Aggregations

Repo (com.jcabi.github.Repo)57 Test (org.junit.Test)55 Coordinates (com.jcabi.github.Coordinates)11 Issue (com.jcabi.github.Issue)10 Repos (com.jcabi.github.Repos)10 References (com.jcabi.github.References)5 Github (com.jcabi.github.Github)3 JsonObject (javax.json.JsonObject)3 Comment (com.jcabi.github.Comment)2 Content (com.jcabi.github.Content)2 Event (com.jcabi.github.Event)2 RepoCommit (com.jcabi.github.RepoCommit)2 ArrayMap (com.jcabi.immutable.ArrayMap)2 Branch (com.jcabi.github.Branch)1 Contents (com.jcabi.github.Contents)1 Fork (com.jcabi.github.Fork)1 IssueLabels (com.jcabi.github.IssueLabels)1 Label (com.jcabi.github.Label)1 Labels (com.jcabi.github.Labels)1 Language (com.jcabi.github.Language)1