Skip to content

Commit 2efaac3

Browse files
committed
fix tests for SearchTest
1 parent 0d9322f commit 2efaac3

File tree

3 files changed

+82
-6
lines changed

3 files changed

+82
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ public void testSearchIssue() throws Exception {
6363
when(github.request(ISSUES_URI + "?q=bogus-q", SearchIssues.class)).thenReturn(fixture);
6464
final SearchIssues search =
6565
searchClient.issues(ImmutableSearchParameters.builder().q("bogus-q").build()).get();
66-
assertSearchIssues(search, 35802);
66+
assertSearchIssues(search);
6767
}
6868
}

src/test/java/com/spotify/github/v3/search/SearchTest.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434

3535
public class SearchTest {
3636

37-
public static final void assertSearchIssues(final SearchIssues search, long id) {
37+
public static final void assertSearchIssues(final SearchIssues search) {
3838
final Issue issues = search.items().get(0);
3939
assertThat(search.totalCount(), is(280));
4040
assertThat(search.incompleteResults(), is(false));
4141
assertThat(
4242
issues.url(),
4343
is(URI.create("https://api.github.com/repos/batterseapower/pinyin-toolkit/issues/132")));
4444
assertThat(issues.number(), is(132));
45-
assertThat(issues.id(), is(id));
45+
assertThat(issues.id(), is(35802L));
4646
assertThat(issues.title(), is("Line Number Indexes Beyond 20 Not Displayed"));
4747
}
4848

@@ -52,15 +52,19 @@ public void testDeserialization() throws IOException {
5252
Resources.toString(getResource(this.getClass(), "issues.json"), defaultCharset());
5353

5454
final SearchIssues search = Json.create().fromJson(fixture, SearchIssues.class);
55-
assertSearchIssues(search, 35802);
55+
assertSearchIssues(search);
5656
}
5757

5858
@Test
5959
public void testDeserializationWithLargeIssueId() throws IOException {
6060
final String fixture =
61-
Resources.toString(getResource(this.getClass(), "issues-with-large-id.json"), defaultCharset());
61+
Resources.toString(getResource(this.getClass(), "issues-long-id.json"), defaultCharset());
6262

6363
final SearchIssues search = Json.create().fromJson(fixture, SearchIssues.class);
64-
assertSearchIssues(search, 2147534768L);
64+
assertThat(search.items().size(), is(1));
65+
66+
final Issue issue = search.items().get(0);
67+
assertThat(issue.id(), is(2592843837L));
68+
assertThat(issue.number(), is(5514));
6569
}
6670
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"total_count": 280,
3+
"incomplete_results": false,
4+
"items": [
5+
{
6+
"url": "https://api.github.com/repos/spotify/scio/issues/5514",
7+
"repository_url": "https://api.github.com/repos/spotify/scio",
8+
"labels_url": "https://api.github.com/repos/spotify/scio/issues/5514/labels{/name}",
9+
"comments_url": "https://api.github.com/repos/spotify/scio/issues/5514/comments",
10+
"events_url": "https://api.github.com/repos/spotify/scio/issues/5514/events",
11+
"html_url": "https://github.com/spotify/scio/issues/5514",
12+
"id": 2592843837,
13+
"node_id": "I_kwDOAfa55s6ai6g9",
14+
"number": 5514,
15+
"title": "Benchmark BigTable maxPendingRequests",
16+
"user": {
17+
"login": "kellen",
18+
"id": 486691,
19+
"node_id": "MDQ6VXNlcjQ4NjY5MQ==",
20+
"avatar_url": "https://avatars.githubusercontent.com/u/486691?v=4",
21+
"gravatar_id": "",
22+
"url": "https://api.github.com/users/kellen",
23+
"html_url": "https://github.com/kellen",
24+
"followers_url": "https://api.github.com/users/kellen/followers",
25+
"following_url": "https://api.github.com/users/kellen/following{/other_user}",
26+
"gists_url": "https://api.github.com/users/kellen/gists{/gist_id}",
27+
"starred_url": "https://api.github.com/users/kellen/starred{/owner}{/repo}",
28+
"subscriptions_url": "https://api.github.com/users/kellen/subscriptions",
29+
"organizations_url": "https://api.github.com/users/kellen/orgs",
30+
"repos_url": "https://api.github.com/users/kellen/repos",
31+
"events_url": "https://api.github.com/users/kellen/events{/privacy}",
32+
"received_events_url": "https://api.github.com/users/kellen/received_events",
33+
"type": "User",
34+
"user_view_type": "public",
35+
"site_admin": false
36+
},
37+
"labels": [
38+
39+
],
40+
"state": "open",
41+
"locked": false,
42+
"assignee": null,
43+
"assignees": [
44+
45+
],
46+
"milestone": null,
47+
"comments": 0,
48+
"created_at": "2024-10-16T19:23:04Z",
49+
"updated_at": "2024-10-16T19:23:40Z",
50+
"closed_at": null,
51+
"author_association": "CONTRIBUTOR",
52+
"active_lock_reason": null,
53+
"body": "Internal spotify discussions suggest that the default `maxPendingRequests=1` may no longer be a good default and a higher value (e.g. `6`) may make more sense for batch. \r\n\r\nWe should write some benchmarks to verify and update the documentation and/or defaults based on the benchmark results.\r\n",
54+
"closed_by": null,
55+
"reactions": {
56+
"url": "https://api.github.com/repos/spotify/scio/issues/5514/reactions",
57+
"total_count": 0,
58+
"+1": 0,
59+
"-1": 0,
60+
"laugh": 0,
61+
"hooray": 0,
62+
"confused": 0,
63+
"heart": 0,
64+
"rocket": 0,
65+
"eyes": 0
66+
},
67+
"timeline_url": "https://api.github.com/repos/spotify/scio/issues/5514/timeline",
68+
"performed_via_github_app": null,
69+
"state_reason": null
70+
}
71+
]
72+
}

0 commit comments

Comments
 (0)