43
43
import com .google .common .io .Resources ;
44
44
import com .spotify .github .async .Async ;
45
45
import com .spotify .github .async .AsyncPage ;
46
+ import com .spotify .github .http .HttpResponse ;
46
47
import com .spotify .github .jackson .Json ;
47
48
import com .spotify .github .v3 .ImmutableUser ;
48
49
import com .spotify .github .v3 .comment .Comment ;
@@ -83,13 +84,13 @@ public void testCommentPaginationSpliterator() throws IOException {
83
84
"<https://github.com/api/v3/repos/someowner/somerepo/issues/123/comments?page=2>; rel=\" next\" , <https://github.com/api/v3/repos/someowner/somerepo/issues/123/comments?page=2>; rel=\" last\" " ;
84
85
final String firstPageBody =
85
86
Resources .toString (getResource (this .getClass (), "comments_page1.json" ), defaultCharset ());
86
- final Response firstPageResponse = createMockResponse (firstPageLink , firstPageBody );
87
+ final HttpResponse firstPageResponse = createMockResponse (firstPageLink , firstPageBody );
87
88
88
89
final String lastPageLink =
89
90
"<https://github.com/api/v3/repos/someowner/somerepo/issues/123/comments>; rel=\" first\" , <https://github.com/api/v3/repos/someowner/somerepo/issues/123/comments>; rel=\" prev\" " ;
90
91
final String lastPageBody =
91
92
Resources .toString (getResource (this .getClass (), "comments_page2.json" ), defaultCharset ());
92
- final Response lastPageResponse = createMockResponse (lastPageLink , lastPageBody );
93
+ final HttpResponse lastPageResponse = createMockResponse (lastPageLink , lastPageBody );
93
94
94
95
when (github .request (format (COMMENTS_URI_NUMBER_TEMPLATE , "someowner" , "somerepo" , "123" )))
95
96
.thenReturn (completedFuture (firstPageResponse ));
@@ -112,13 +113,13 @@ public void testCommentPaginationForeach() throws IOException {
112
113
"<https://github.com/api/v3/repos/someowner/somerepo/issues/123/comments?page=2>; rel=\" next\" , <https://github.com/api/v3/repos/someowner/somerepo/issues/123/comments?page=2>; rel=\" last\" " ;
113
114
final String firstPageBody =
114
115
Resources .toString (getResource (this .getClass (), "comments_page1.json" ), defaultCharset ());
115
- final Response firstPageResponse = createMockResponse (firstPageLink , firstPageBody );
116
+ final HttpResponse firstPageResponse = createMockResponse (firstPageLink , firstPageBody );
116
117
117
118
final String lastPageLink =
118
119
"<https://github.com/api/v3/repos/someowner/somerepo/issues/123/comments>; rel=\" first\" , <https://github.com/api/v3/repos/someowner/somerepo/issues/123/comments>; rel=\" prev\" " ;
119
120
final String lastPageBody =
120
121
Resources .toString (getResource (this .getClass (), "comments_page2.json" ), defaultCharset ());
121
- final Response lastPageResponse = createMockResponse (lastPageLink , lastPageBody );
122
+ final HttpResponse lastPageResponse = createMockResponse (lastPageLink , lastPageBody );
122
123
123
124
when (github .request (format (COMMENTS_URI_NUMBER_TEMPLATE , "someowner" , "somerepo" , "123" )))
124
125
.thenReturn (completedFuture (firstPageResponse ));
@@ -142,7 +143,7 @@ public void testCommentPaginationForeach() throws IOException {
142
143
@ Test
143
144
public void testCommentCreated () throws IOException {
144
145
final String fixture = loadFixture ("clients/comment_created.json" );
145
- final Response response = createMockResponse ("" , fixture );
146
+ final HttpResponse response = createMockResponse ("" , fixture );
146
147
final String path = format (COMMENTS_URI_NUMBER_TEMPLATE , "someowner" , "somerepo" , 10 );
147
148
when (github .post (anyString (), anyString (), eq (Comment .class ))).thenCallRealMethod ();
148
149
when (github .post (eq (path ), anyString ())).thenReturn (completedFuture (response ));
@@ -154,7 +155,7 @@ public void testCommentCreated() throws IOException {
154
155
@ Test
155
156
public void testCommentCreatedWithLargeId () throws IOException {
156
157
final String fixture = loadFixture ("clients/comment_created_long_id.json" );
157
- final Response response = createMockResponse ("" , fixture );
158
+ final HttpResponse response = createMockResponse ("" , fixture );
158
159
final String path = format (COMMENTS_URI_NUMBER_TEMPLATE , "someowner" , "somerepo" , 10 );
159
160
when (github .post (anyString (), anyString (), eq (Comment .class ))).thenCallRealMethod ();
160
161
when (github .post (eq (path ), anyString ())).thenReturn (completedFuture (response ));
@@ -210,8 +211,8 @@ public void testDeleteIssueCommentReaction() {
210
211
long reactionId = 385825 ;
211
212
final String path =
212
213
format (COMMENTS_REACTION_ID_TEMPLATE , "someowner" , "somerepo" , issueNumber , reactionId );
213
- Response mockResponse = mock (Response .class );
214
- when (mockResponse .code ()).thenReturn (204 );
214
+ HttpResponse mockResponse = mock (HttpResponse .class );
215
+ when (mockResponse .statusCode ()).thenReturn (204 );
215
216
when (github .delete (eq (path ))).thenReturn (completedFuture (mockResponse ));
216
217
217
218
final var response = issueClient .deleteCommentReaction (issueNumber , reactionId ).join ();
@@ -239,7 +240,7 @@ public void testListIssueCommentReaction() throws IOException {
239
240
"<https://github.com/api/v3/repos/someowner/somerepo/comments/%s/reactions?page=1>; rel=\" last\" " ,
240
241
commentId );
241
242
final String firstPageBody = github .json ().toJsonUnchecked (listResponse .join ().toArray ());
242
- final Response firstPageResponse = createMockResponse (firstPageLink , firstPageBody );
243
+ final HttpResponse firstPageResponse = createMockResponse (firstPageLink , firstPageBody );
243
244
244
245
when (github .request (eq (path ))).thenReturn (completedFuture (firstPageResponse ));
245
246
final List <CommentReaction > listCommentReactions = Lists .newArrayList ();
0 commit comments