Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ada9b49

Browse filesBrowse files
committed
Add Wiremock snapshot files for checkNonExistentReviewer
1 parent e54d410 commit ada9b49
Copy full SHA for ada9b49
Expand file treeCollapse file tree

12 files changed

+786
-5
lines changed

‎src/main/java/org/kohsuke/github/GHPullRequestReview.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHPullRequestReview.java
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ public String getBody() {
8080
* the io exception
8181
*/
8282
public GHUser getUser() throws IOException {
83-
return owner.root().getUser(user.getLogin());
83+
if (user != null) {
84+
return owner.root().getUser(user.getLogin());
85+
}
86+
return null;
8487
}
8588

8689
/**

‎src/test/java/org/kohsuke/github/GHPullRequestTest.java

Copy file name to clipboardExpand all lines: src/test/java/org/kohsuke/github/GHPullRequestTest.java
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.Collection;
1010
import java.util.Collections;
1111
import java.util.List;
12+
import java.util.Optional;
1213

1314
import static org.hamcrest.Matchers.*;
1415

@@ -544,15 +545,19 @@ public void getUserTest() throws IOException {
544545
}
545546

546547
@Test
547-
public void checkNonExistentReviewerTest() throws IOException {
548-
final GHRepository repository = getRepository();
549-
final GHPullRequest pullRequest = repository.getPullRequest(1);
548+
public void checkNonExistentReviewer() throws IOException, NullPointerException {
549+
// PR id is based on https://github.com/sahansera/TestRepo/pull/1
550+
final GHPullRequest pullRequest = getRepository().getPullRequest(1);
551+
final Optional<GHPullRequestReview> review = pullRequest.listReviews().toList().stream().findFirst();
552+
final GHUser reviewer = review.get().getUser();
550553

551554
assertThat(pullRequest.getRequestedReviewers(), is(empty()));
555+
assertThat(review, notNullValue());
556+
assertThat(reviewer, is(nullValue()));
552557
}
553558

554559
@Test
555-
public void checkNonExistentUserTest() throws IOException {
560+
public void checkNonExistentUser() throws IOException {
556561
final GHRepository repository = getRepository();
557562
final GHPullRequest pullRequest = repository.getPullRequest(2);
558563

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"login": "hub4j-test-org",
3+
"id": 7544739,
4+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
5+
"url": "https://api.github.com/orgs/hub4j-test-org",
6+
"repos_url": "https://api.github.com/orgs/hub4j-test-org/repos",
7+
"events_url": "https://api.github.com/orgs/hub4j-test-org/events",
8+
"hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks",
9+
"issues_url": "https://api.github.com/orgs/hub4j-test-org/issues",
10+
"members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}",
11+
"public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}",
12+
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
13+
"description": null,
14+
"is_verified": false,
15+
"has_organization_projects": true,
16+
"has_repository_projects": true,
17+
"public_repos": 9,
18+
"public_gists": 0,
19+
"followers": 0,
20+
"following": 0,
21+
"html_url": "https://github.com/hub4j-test-org",
22+
"created_at": "2014-05-10T19:39:11Z",
23+
"updated_at": "2015-04-20T00:42:30Z",
24+
"type": "Organization",
25+
"total_private_repos": 0,
26+
"owned_private_repos": 0,
27+
"private_gists": 0,
28+
"disk_usage": 132,
29+
"collaborators": 0,
30+
"billing_email": "kk@kohsuke.org",
31+
"default_repository_permission": "none",
32+
"members_can_create_repositories": false,
33+
"two_factor_requirement_enabled": false,
34+
"plan": {
35+
"name": "free",
36+
"space": 976562499,
37+
"private_repos": 0,
38+
"filled_seats": 3,
39+
"seats": 0
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
{
2+
"id": 423321524,
3+
"node_id": "R_kgDOGTtftA",
4+
"name": "github-api",
5+
"full_name": "hub4j-test-org/github-api",
6+
"private": false,
7+
"owner": {
8+
"login": "hub4j-test-org",
9+
"id": 2032296,
10+
"node_id": "MDQ6VXNlcjIwMzIyOTY=",
11+
"avatar_url": "https://avatars.githubusercontent.com/u/2032296?v=4",
12+
"gravatar_id": "",
13+
"url": "https://api.github.com/users/hub4j-test-org",
14+
"html_url": "https://github.com/hub4j-test-org",
15+
"followers_url": "https://api.github.com/users/hub4j-test-org/followers",
16+
"following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
17+
"gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
18+
"starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
19+
"subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
20+
"organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
21+
"repos_url": "https://api.github.com/users/hub4j-test-org/repos",
22+
"events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
23+
"received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
24+
"type": "User",
25+
"site_admin": true
26+
},
27+
"html_url": "https://github.com/hub4j-test-org/github-api",
28+
"description": "Recreating an issue",
29+
"fork": false,
30+
"url": "https://api.github.com/repos/hub4j-test-org/github-api",
31+
"forks_url": "https://api.github.com/repos/hub4j-test-org/github-api/forks",
32+
"keys_url": "https://api.github.com/repos/hub4j-test-org/github-api/keys{/key_id}",
33+
"collaborators_url": "https://api.github.com/repos/hub4j-test-org/github-api/collaborators{/collaborator}",
34+
"teams_url": "https://api.github.com/repos/hub4j-test-org/github-api/teams",
35+
"hooks_url": "https://api.github.com/repos/hub4j-test-org/github-api/hooks",
36+
"issue_events_url": "https://api.github.com/repos/hub4j-test-org/github-api/issues/events{/number}",
37+
"events_url": "https://api.github.com/repos/hub4j-test-org/github-api/events",
38+
"assignees_url": "https://api.github.com/repos/hub4j-test-org/github-api/assignees{/user}",
39+
"branches_url": "https://api.github.com/repos/hub4j-test-org/github-api/branches{/branch}",
40+
"tags_url": "https://api.github.com/repos/hub4j-test-org/github-api/tags",
41+
"blobs_url": "https://api.github.com/repos/hub4j-test-org/github-api/git/blobs{/sha}",
42+
"git_tags_url": "https://api.github.com/repos/hub4j-test-org/github-api/git/tags{/sha}",
43+
"git_refs_url": "https://api.github.com/repos/hub4j-test-org/github-api/git/refs{/sha}",
44+
"trees_url": "https://api.github.com/repos/hub4j-test-org/github-api/git/trees{/sha}",
45+
"statuses_url": "https://api.github.com/repos/hub4j-test-org/github-api/statuses/{sha}",
46+
"languages_url": "https://api.github.com/repos/hub4j-test-org/github-api/languages",
47+
"stargazers_url": "https://api.github.com/repos/hub4j-test-org/github-api/stargazers",
48+
"contributors_url": "https://api.github.com/repos/hub4j-test-org/github-api/contributors",
49+
"subscribers_url": "https://api.github.com/repos/hub4j-test-org/github-api/subscribers",
50+
"subscription_url": "https://api.github.com/repos/hub4j-test-org/github-api/subscription",
51+
"commits_url": "https://api.github.com/repos/hub4j-test-org/github-api/commits{/sha}",
52+
"git_commits_url": "https://api.github.com/repos/hub4j-test-org/github-api/git/commits{/sha}",
53+
"comments_url": "https://api.github.com/repos/hub4j-test-org/github-api/comments{/number}",
54+
"issue_comment_url": "https://api.github.com/repos/hub4j-test-org/github-api/issues/comments{/number}",
55+
"contents_url": "https://api.github.com/repos/hub4j-test-org/github-api/contents/{+path}",
56+
"compare_url": "https://api.github.com/repos/hub4j-test-org/github-api/compare/{base}...{head}",
57+
"merges_url": "https://api.github.com/repos/hub4j-test-org/github-api/merges",
58+
"archive_url": "https://api.github.com/repos/hub4j-test-org/github-api/{archive_format}{/ref}",
59+
"downloads_url": "https://api.github.com/repos/hub4j-test-org/github-api/downloads",
60+
"issues_url": "https://api.github.com/repos/hub4j-test-org/github-api/issues{/number}",
61+
"pulls_url": "https://api.github.com/repos/hub4j-test-org/github-api/pulls{/number}",
62+
"milestones_url": "https://api.github.com/repos/hub4j-test-org/github-api/milestones{/number}",
63+
"notifications_url": "https://api.github.com/repos/hub4j-test-org/github-api/notifications{?since,all,participating}",
64+
"labels_url": "https://api.github.com/repos/hub4j-test-org/github-api/labels{/name}",
65+
"releases_url": "https://api.github.com/repos/hub4j-test-org/github-api/releases{/id}",
66+
"deployments_url": "https://api.github.com/repos/hub4j-test-org/github-api/deployments",
67+
"created_at": "2021-11-01T03:08:27Z",
68+
"updated_at": "2021-11-01T03:09:57Z",
69+
"pushed_at": "2021-11-08T13:29:40Z",
70+
"git_url": "git://github.com/hub4j-test-org/github-api.git",
71+
"ssh_url": "git@github.com:hub4j-test-org/github-api.git",
72+
"clone_url": "https://github.com/hub4j-test-org/github-api.git",
73+
"svn_url": "https://github.com/hub4j-test-org/github-api",
74+
"homepage": null,
75+
"size": 2,
76+
"stargazers_count": 0,
77+
"watchers_count": 0,
78+
"language": null,
79+
"has_issues": true,
80+
"has_projects": true,
81+
"has_downloads": true,
82+
"has_wiki": true,
83+
"has_pages": false,
84+
"forks_count": 0,
85+
"mirror_url": null,
86+
"archived": false,
87+
"disabled": false,
88+
"open_issues_count": 0,
89+
"license": null,
90+
"allow_forking": true,
91+
"is_template": false,
92+
"topics": [],
93+
"visibility": "public",
94+
"forks": 0,
95+
"open_issues": 0,
96+
"watchers": 0,
97+
"default_branch": "main",
98+
"permissions": {
99+
"admin": true,
100+
"maintain": true,
101+
"push": true,
102+
"triage": true,
103+
"pull": true
104+
},
105+
"temp_clone_token": "",
106+
"allow_squash_merge": true,
107+
"allow_merge_commit": true,
108+
"allow_rebase_merge": true,
109+
"allow_auto_merge": false,
110+
"delete_branch_on_merge": false,
111+
"allow_update_branch": false,
112+
"network_count": 0,
113+
"subscribers_count": 1
114+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.