Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different ways of getting issue.getClosedby() return different results. #113

Closed
anthonyms opened this issue Jul 29, 2014 · 2 comments
Closed

Comments

@anthonyms
Copy link

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();
        }
    }
}
@anthonyms
Copy link
Author

Related to #60.

It is indeed a gihub api issue.

@kohsuke
Copy link
Collaborator

kohsuke commented Feb 15, 2015

I agree this looks like a duplicate of issue #60.

@kohsuke kohsuke closed this as completed Feb 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants