Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/spotify/github/v3/comment/Comment.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public interface Comment extends UpdateTracking {
URI htmlUrl();

/** Comment ID. */
int id();
Long id();

/** The {@link User} that made the comment. */
@Nullable
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/spotify/github/v3/issues/Issue.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public interface Issue extends CloseTracking {

/** ID. */
@Nullable
Integer id();
Long id();

/** URL. */
@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public interface PullRequestItem extends CloseTracking {

/** ID. */
@Nullable
Integer id();
Long id();

/** URL. */
@Nullable
Expand Down
24 changes: 18 additions & 6 deletions src/test/java/com/spotify/github/v3/clients/IssueClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ public void testCommentPaginationSpliterator() throws IOException {
Async.streamFromPaginatingIterable(pageIterator).collect(toList());

assertThat(listComments.size(), is(30));
assertThat(listComments.get(0).id(), is(1345268));
assertThat(listComments.get(listComments.size() - 1).id(), is(1356168));
assertThat(listComments.get(0).id(), is(1345268L));
assertThat(listComments.get(listComments.size() - 1).id(), is(1356168L));
}

@Test
Expand Down Expand Up @@ -135,8 +135,8 @@ public void testCommentPaginationForeach() throws IOException {
});

assertThat(listComments.size(), is(30));
assertThat(listComments.get(0).id(), is(1345268));
assertThat(listComments.get(listComments.size() - 1).id(), is(1356168));
assertThat(listComments.get(0).id(), is(1345268L));
assertThat(listComments.get(listComments.size() - 1).id(), is(1356168L));
}

@Test
Expand All @@ -148,7 +148,19 @@ public void testCommentCreated() throws IOException {
when(github.post(eq(path), anyString())).thenReturn(completedFuture(response));
final Comment comment = issueClient.createComment(10, "Me too").join();

assertThat(comment.id(), is(114));
assertThat(comment.id(), is(114L));
}

@Test
public void testCommentCreatedWithLargeId() throws IOException {
final String fixture = loadFixture("clients/comment_created_long_id.json");
final Response response = createMockResponse("", fixture);
final String path = format(COMMENTS_URI_NUMBER_TEMPLATE, "someowner", "somerepo", 10);
when(github.post(anyString(), anyString(), eq(Comment.class))).thenCallRealMethod();
when(github.post(eq(path), anyString())).thenReturn(completedFuture(response));
final Comment comment = issueClient.createComment(10, "Me too").join();

assertThat(comment.id(), is(2459198527L));
}

@Test
Expand All @@ -160,7 +172,7 @@ public void testGetIssue() throws IOException {

final var issue = issueClient.getIssue(2).join();

assertThat(issue.id(), is(2));
assertThat(issue.id(), is(2L));
assertNotNull(issue.labels());
assertFalse(issue.labels().isEmpty());
assertThat(issue.labels().get(0).name(), is("bug"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public void testCommentCreated() throws IOException {
.thenReturn(fixture);
final Comment comment = repoClient.createComment("someweirdsha", "Me too").join();

assertThat(comment.id(), is(123));
assertThat(comment.id(), is(123L));
assertThat(comment.commitId().get(), is("6dcb09b5b57875f334f61aebed695e2e4193db5e"));
}

Expand All @@ -551,7 +551,7 @@ public void getComment() throws IOException {
.thenReturn(fixture);
final Comment comment = repoClient.getComment(123).join();

assertThat(comment.id(), is(123));
assertThat(comment.id(), is(123L));
assertThat(comment.commitId().get(), is("6dcb09b5b57875f334f61aebed695e2e4193db5e"));
}

Expand Down
15 changes: 15 additions & 0 deletions src/test/java/com/spotify/github/v3/prs/PullRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public void testDeserializationPr() throws IOException {
String fixture =
Resources.toString(getResource(this.getClass(), "pull_request.json"), defaultCharset());
final PullRequest pr = Json.create().fromJson(fixture, PullRequest.class);

assertThat(pr.id(), is(1L));
assertThat(pr.nodeId(), is("MDExOlB1bGxSZXF1ZXN0NDI3NDI0Nw=="));
assertThat(pr.mergeCommitSha().get(), is("e5bd3914e2e596debea16f433f57875b5b90bcd6"));
assertThat(pr.merged(), is(false));
Expand All @@ -53,6 +55,19 @@ public void testDeserializationPr() throws IOException {
assertThat(pr.labels().get(0).color(),is("ff0000"));
}

@Test
public void testDeserializationPrWithLargeId() throws IOException {
String fixture =
Resources.toString(getResource(this.getClass(), "pull_request_long_id.json"), defaultCharset());
final PullRequest pr = Json.create().fromJson(fixture, PullRequest.class);

assertThat(pr.id(), is(2459198527L));
assertThat(pr.head().sha(), is("f74c7f420282f584acd2fb5964202e5b525c3ab8"));
assertThat(pr.merged(), is(false));
assertThat(pr.mergeable().get(), is(false));
assertThat(pr.draft(), is(Optional.of(true)));
}

@Test
public void testSerializationMergeParams() throws IOException {
String fixture =
Expand Down
15 changes: 14 additions & 1 deletion src/test/java/com/spotify/github/v3/search/SearchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static final void assertSearchIssues(final SearchIssues search) {
issues.url(),
is(URI.create("https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132")));
assertThat(issues.number(), is(132));
assertThat(issues.id(), is(35802));
assertThat(issues.id(), is(35802L));
assertThat(issues.title(), is("Line Number Indexes Beyond 20 Not Displayed"));
}

Expand All @@ -54,4 +54,17 @@ public void testDeserialization() throws IOException {
final SearchIssues search = Json.create().fromJson(fixture, SearchIssues.class);
assertSearchIssues(search);
}

@Test
public void testDeserializationWithLargeIssueId() throws IOException {
final String fixture =
Resources.toString(getResource(this.getClass(), "issues-long-id.json"), defaultCharset());

final SearchIssues search = Json.create().fromJson(fixture, SearchIssues.class);
assertThat(search.items().size(), is(1));

final Issue issue = search.items().get(0);
assertThat(issue.id(), is(2592843837L));
assertThat(issue.number(), is(5514));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"url": "https://api.github.com/repos/spotify/github-java-client/issues/comments/1958720937",
"html_url": "https://github.com/spotify/github-java-client/pull/180#issuecomment-1958720937",
"issue_url": "https://api.github.com/repos/spotify/github-java-client/issues/180",
"id": 2459198527,
"node_id": "IC_kwDODynaQc50v7Wp",
"user": {
"login": "vootelerotov",
"id": 1439555,
"node_id": "MDQ6VXNlcjE0Mzk1NTU=",
"avatar_url": "https://avatars.githubusercontent.com/u/1439555?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/vootelerotov",
"html_url": "https://github.com/vootelerotov",
"followers_url": "https://api.github.com/users/vootelerotov/followers",
"following_url": "https://api.github.com/users/vootelerotov/following{/other_user}",
"gists_url": "https://api.github.com/users/vootelerotov/gists{/gist_id}",
"starred_url": "https://api.github.com/users/vootelerotov/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/vootelerotov/subscriptions",
"organizations_url": "https://api.github.com/users/vootelerotov/orgs",
"repos_url": "https://api.github.com/users/vootelerotov/repos",
"events_url": "https://api.github.com/users/vootelerotov/events{/privacy}",
"received_events_url": "https://api.github.com/users/vootelerotov/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
},
"created_at": "2024-02-22T05:19:44Z",
"updated_at": "2024-02-22T05:19:44Z",
"author_association": "CONTRIBUTOR",
"body": "Ran into this in the wild.",
"reactions": {
"url": "https://api.github.com/repos/spotify/github-java-client/issues/comments/1958720937/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"performed_via_github_app": null
}
Loading