The following test case shows that calling issue.getRepository().getIssue(issue.getNumber()) .getClosedBy() at times yields different results from issue.getClosedBy().
Also not all closed issues return the GHuser who closed them whereas github shows the closer of the issue.
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import org.junit.BeforeClass;
import org.junit.Test;
import org.kohsuke.github.GHIssue;
import org.kohsuke.github.GHIssueState;
import org.kohsuke.github.GHRepository;
import org.kohsuke.github.GitHub;
public class IssueTester {
private static GHRepository repo;
@BeforeClass
public static void setup() {
try {
repo = GitHub.connectAnonymously().getRepository(
"kohsuke/github-api");
} catch (IOException e) {
e.printStackTrace();
}
}
// These two ways of gettting closers must return same GHUser
@Test
public void testGetCloser() {
try {
for (GHIssue issue : repo.getIssues(GHIssueState.CLOSED)) {
assertEquals(issue.getRepository().getIssue(issue.getNumber())
.getClosedBy(), issue.getClosedBy());
}
} catch (IOException e) {
e.printStackTrace();
}
}
// Every closed issue must have been closed by someone
@Test
public void testClosedIssue() {
try {
for (GHIssue issue : repo.getIssues(GHIssueState.CLOSED)) {
assert (issue.getClosedBy() != null);
assert (issue.getRepository().getIssue(issue.getNumber())
.getClosedBy() != null);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
The following test case shows that calling
issue.getRepository().getIssue(issue.getNumber()) .getClosedBy()at times yields different results fromissue.getClosedBy().Also not all closed issues return the
GHuserwho closed them whereas github shows the closer of the issue.