use of com.jcabi.github.Issue in project jcabi-github by jcabi.
the class MkIssueLabelsTest method iteratesIssues.
/**
* MkIssueLabels can list labels.
* @throws Exception If some problem inside
*/
@Test
public void iteratesIssues() throws Exception {
final Repo repo = new MkGithub().randomRepo();
final String name = "bug";
repo.labels().create(name, "c0c0c0");
final Issue issue = repo.issues().create("title", "body");
issue.labels().add(Collections.singletonList(name));
MatcherAssert.assertThat(issue.labels().iterate(), Matchers.<Label>iterableWithSize(1));
}
use of com.jcabi.github.Issue in project jcabi-github by jcabi.
the class MkIssueLabelsTest method removingLabelGeneratesEvent.
/**
* MkIssueLabels creates an "unlabeled" event when a label is removed.
* @throws Exception If some problem inside
*/
@Test
public void removingLabelGeneratesEvent() throws Exception {
final Repo repo = new MkGithub().randomRepo();
final String name = "invalid";
repo.labels().create(name, "ee82ee");
final Issue issue = repo.issues().create("Rewrite", "Sound good?");
issue.labels().add(Collections.singletonList(name));
issue.labels().remove(name);
MatcherAssert.assertThat(issue.events(), Matchers.<Event>iterableWithSize(2));
final Iterator<Event> events = issue.events().iterator();
events.next();
final Event.Smart unlabeled = new Event.Smart(events.next());
MatcherAssert.assertThat(unlabeled.type(), Matchers.equalTo(Event.UNLABELED));
MatcherAssert.assertThat(unlabeled.author().login(), Matchers.equalTo(USER));
MatcherAssert.assertThat(unlabeled.repo(), Matchers.equalTo(repo));
MatcherAssert.assertThat(unlabeled.label().get().name(), Matchers.equalTo(name));
}
use of com.jcabi.github.Issue in project jcabi-github by jcabi.
the class MkIssueTest method showsIssueAuthor.
/**
* MkIssue can show an issue author.
* @throws Exception If some problem inside
*/
@Test
public void showsIssueAuthor() throws Exception {
final Issue issue = this.issue();
MatcherAssert.assertThat(new Issue.Smart(issue).author().login(), Matchers.notNullValue());
}
use of com.jcabi.github.Issue in project jcabi-github by jcabi.
the class MkIssueTest method opensAndCloses.
/**
* MkIssue can open and close.
* @throws Exception If some problem inside
*/
@Test
public void opensAndCloses() throws Exception {
final Issue issue = this.issue();
MatcherAssert.assertThat(new Issue.Smart(issue).isOpen(), Matchers.is(true));
new Issue.Smart(issue).close();
MatcherAssert.assertThat(new Issue.Smart(issue).isOpen(), Matchers.is(false));
}
use of com.jcabi.github.Issue in project jcabi-github by jcabi.
the class MkIssueTest method listsReadOnlyLabels.
/**
* MkIssue can list its labels.
* @throws Exception If some problem inside
*/
@Test
public void listsReadOnlyLabels() throws Exception {
final Issue issue = this.issue();
final String tag = "test-tag";
issue.repo().labels().create(tag, "c0c0c0");
issue.labels().add(Collections.singletonList(tag));
MatcherAssert.assertThat(new Issue.Smart(issue).roLabels().iterate(), Matchers.<Label>hasItem(new CustomMatcher<Label>("label just created") {
@Override
public boolean matches(final Object item) {
return Label.class.cast(item).name().equals(tag);
}
}));
}
Aggregations