Skip to content

Commit 9967b20

Browse files
authored
fix: type for CheckrunResponse to support long id (#114)
1 parent 3e1afa4 commit 9967b20

File tree

4 files changed

+91
-3
lines changed

4 files changed

+91
-3
lines changed

src/main/java/com/spotify/github/v3/checks/CheckRunResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public interface CheckRunResponse extends CheckRunBase {
3636
*
3737
* @return the int
3838
*/
39-
int id();
39+
long id();
4040

4141
/**
4242
* Url string.

src/main/java/com/spotify/github/v3/clients/ChecksClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public CompletableFuture<CheckRunResponse> updateCheckRun(
9696
* @param id the checkRun id
9797
* @return a CheckRunResponse
9898
*/
99-
public CompletableFuture<CheckRunResponse> getCheckRun(final int id) {
99+
public CompletableFuture<CheckRunResponse> getCheckRun(final long id) {
100100
final String path = String.format(GET_CHECK_RUN_URI, owner, repo, id);
101101
return github.request(path, CheckRunResponse.class, extraHeaders);
102102
}

src/test/java/com/spotify/github/v3/clients/ChecksClientTest.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,26 @@ public void getCompletedCheckRun() throws Exception {
128128
final CompletableFuture<CheckRunResponse> actualResponse = checksClient.getCheckRun(4);
129129

130130
assertThat(actualResponse.get().status(), is(completed));
131-
assertThat(actualResponse.get().id(), is(4));
131+
assertThat(actualResponse.get().id(), is(4L));
132132
assertThat(actualResponse.get().headSha(), is("ce587453ced02b1526dfb4cb910479d431683101"));
133133
assertThat(actualResponse.get().output().annotationsCount().get(), is(2));
134134
}
135135

136+
@Test
137+
public void getCompletedCheckRunWithLongId() throws Exception {
138+
final CheckRunResponse checkRunResponse =
139+
json.fromJson(
140+
loadResource(FIXTURES_PATH + "checks-run-completed-long-id-response.json"),
141+
CheckRunResponse.class);
142+
143+
final CompletableFuture<CheckRunResponse> fixtureResponse = completedFuture(checkRunResponse);
144+
when(github.request(any(), eq(CheckRunResponse.class), any())).thenReturn(fixtureResponse);
145+
146+
final CompletableFuture<CheckRunResponse> actualResponse = checksClient.getCheckRun(6971753714L);
147+
148+
assertThat(actualResponse.get().id(), is(6971753714L));
149+
}
150+
136151
@Test
137152
public void getCheckRunsList() throws Exception {
138153
final CheckRunResponseList checkRunResponse =
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"id": 6971753714,
3+
"head_sha": "ce587453ced02b1526dfb4cb910479d431683101",
4+
"node_id": "MDg6Q2hlY2tSdW40",
5+
"external_id": "",
6+
"url": "https://api.github.com/repos/github/hello-world/check-runs/6971753714",
7+
"html_url": "http://github.com/github/hello-world/runs/6971753714",
8+
"details_url": "https://example.com",
9+
"status": "completed",
10+
"conclusion": "neutral",
11+
"started_at": "2018-05-04T01:14:52Z",
12+
"completed_at": "2018-05-04T01:14:52Z",
13+
"output": {
14+
"title": "Mighty Readme report",
15+
"summary": "There are 0 failures, 2 warnings, and 1 notice.",
16+
"text": "You may have some misspelled words on lines 2 and 4. You also may want to add a section in your README about how to install your app.",
17+
"annotations_count": 2,
18+
"annotations_url": "https://api.github.com/repos/github/hello-world/check-runs/6971753714/annotations"
19+
},
20+
"name": "mighty_readme",
21+
"check_suite": {
22+
"id": 5
23+
},
24+
"app": {
25+
"id": 1,
26+
"node_id": "MDExOkludGVncmF0aW9uMQ==",
27+
"owner": {
28+
"login": "github",
29+
"id": 1,
30+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
31+
"url": "https://api.github.com/orgs/github",
32+
"repos_url": "https://api.github.com/orgs/github/repos",
33+
"events_url": "https://api.github.com/orgs/github/events",
34+
"hooks_url": "https://api.github.com/orgs/github/hooks",
35+
"issues_url": "https://api.github.com/orgs/github/issues",
36+
"members_url": "https://api.github.com/orgs/github/members{/member}",
37+
"public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
38+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
39+
"description": "A great organization"
40+
},
41+
"name": "Super CI",
42+
"description": "",
43+
"external_url": "https://example.com",
44+
"html_url": "https://github.com/apps/super-ci",
45+
"created_at": "2017-07-08T16:18:44-04:00",
46+
"updated_at": "2017-07-08T16:18:44-04:00"
47+
},
48+
"pull_requests": [
49+
{
50+
"url": "https://api.github.com/repos/github/hello-world/pulls/1",
51+
"id": 1934,
52+
"number": 3956,
53+
"head": {
54+
"ref": "say-hello",
55+
"sha": "3dca65fa3e8d4b3da3f3d056c59aee1c50f41390",
56+
"repo": {
57+
"id": 526,
58+
"url": "https://api.github.com/repos/github/hello-world",
59+
"name": "hello-world"
60+
}
61+
},
62+
"base": {
63+
"ref": "master",
64+
"sha": "e7fdf7640066d71ad16a86fbcbb9c6a10a18af4f",
65+
"repo": {
66+
"id": 526,
67+
"url": "https://api.github.com/repos/github/hello-world",
68+
"name": "hello-world"
69+
}
70+
}
71+
}
72+
]
73+
}

0 commit comments

Comments
 (0)