mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-04 08:21:23 +00:00
Updated per review.
- Created separate class for GHIssueEvent instead of nested classes. - Renamed test class accordingly. Other fixes: - Changed id type to long. - Updated test cases. - Added toString() method.
This commit is contained in:
50
src/test/java/org/kohsuke/github/GHIssueEventTest.java
Normal file
50
src/test/java/org/kohsuke/github/GHIssueEventTest.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Martin van Zijl
|
||||
*/
|
||||
public class GHIssueEventTest extends AbstractGitHubApiTestBase {
|
||||
|
||||
@Test
|
||||
public void testEventsForSingleIssue() throws Exception {
|
||||
GHRepository repo = getRepository();
|
||||
GHIssue issue = repo.getIssue(1);
|
||||
|
||||
for (GHIssueEvent event : issue.listEvents()) {
|
||||
System.out.println(event);
|
||||
}
|
||||
|
||||
//TODO: Use the following...
|
||||
//GHIssueBuilder builder = repo.createIssue("test from the api");
|
||||
//GHIssue issue = builder.create();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRepositoryEvents() throws Exception {
|
||||
GHRepository repo = getRepository();
|
||||
PagedIterable<GHIssueEvent> list = repo.listIssueEvents();
|
||||
|
||||
for (GHIssueEvent event : list) {
|
||||
System.out.println(event);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRepositorySingleEvent() throws Exception {
|
||||
GHRepository repo = getRepository();
|
||||
GHIssueEvent event = repo.getIssueEvent(2615868520L);
|
||||
|
||||
System.out.println(event);
|
||||
}
|
||||
|
||||
protected GHRepository getRepository() throws IOException {
|
||||
return getRepository(gitHub);
|
||||
}
|
||||
|
||||
private GHRepository getRepository(GitHub gitHub) throws IOException {
|
||||
return gitHub.getOrganization("github-api-test-org").getRepository("github-api");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user