Skip to content

Commit c6d1d6e

Browse files
committed
fix: allow Review id to be bigger than Integer.MAX
1 parent 643d047 commit c6d1d6e

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

src/main/java/com/spotify/github/v3/prs/Review.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public interface Review {
4444

4545
/** Id. */
4646
@Nullable
47-
Integer id();
47+
Long id();
4848

4949
/** User. */
5050
@Nullable

src/test/java/com/spotify/github/v3/prs/ReviewTest.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,20 @@ public void testDeserialization() throws IOException {
4141
Json.create().fromJson(fixture, Review.class);
4242
assertThat(review.state(), is(ReviewState.APPROVED));
4343
assertThat(review.commitId(), is("ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091"));
44-
assertThat(review.id(), is(80));
44+
assertThat(review.id(), is(80L));
4545
}
46+
47+
@Test
48+
public void testDeserializationWithLargeId() throws IOException {
49+
String fixture =
50+
Resources.toString(
51+
getResource(this.getClass(), "review_long_id.json"),
52+
defaultCharset());
53+
final Review review =
54+
Json.create().fromJson(fixture, Review.class);
55+
assertThat(review.state(), is(ReviewState.APPROVED));
56+
assertThat(review.commitId(), is("ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091"));
57+
assertThat(review.id(), is(2459198580L));
58+
}
59+
4660
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"id": 2459198580,
3+
"node_id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=",
4+
"user": {
5+
"login": "octocat",
6+
"id": 1,
7+
"node_id": "MDQ6VXNlcjE=",
8+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
9+
"gravatar_id": "",
10+
"url": "https://api.github.com/users/octocat",
11+
"html_url": "https://github.com/octocat",
12+
"followers_url": "https://api.github.com/users/octocat/followers",
13+
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
14+
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
15+
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
16+
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
17+
"organizations_url": "https://api.github.com/users/octocat/orgs",
18+
"repos_url": "https://api.github.com/users/octocat/repos",
19+
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
20+
"received_events_url": "https://api.github.com/users/octocat/received_events",
21+
"type": "User",
22+
"site_admin": false
23+
},
24+
"body": "Here is the body for the review.",
25+
"submitted_at": "2019-11-17T17:43:43Z",
26+
"commit_id": "ecdd80bb57125d7ba9641ffaa4d7d2c19d3f3091",
27+
"state": "APPROVED",
28+
"html_url": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80",
29+
"pull_request_url": "https://api.github.com/repos/octocat/Hello-World/pulls/12",
30+
"_links": {
31+
"html": {
32+
"href": "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80"
33+
},
34+
"pull_request": {
35+
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/12"
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)