Separate out clean-up of Pull requests created during test

If the test assertion fails, we want the pull-request to be closed anyway.
You can't have more than one pull-request merging a given branch into
another, so leaving the PR hanging will cause subsequent test runs to fail
in setup.
This commit is contained in:
Roberto Tyley
2014-09-03 23:18:22 +01:00
parent e6d59df705
commit 1a9b8bd1da

View File

@@ -1,5 +1,6 @@
package org.kohsuke.github;
import org.junit.After;
import org.junit.Test;
/**
@@ -13,6 +14,12 @@ public class PullRequestTest extends AbstractGitHubApiTestBase {
GHPullRequest p = j.createPullRequest(name, "stable", "master", "## test");
System.out.println(p.getUrl());
assertEquals(name, p.getTitle());
p.close();
}
@After
public void cleanUp() throws Exception {
for (GHPullRequest pr : getRepository().getPullRequests(GHIssueState.OPEN)) {
pr.close();
}
}
}