@@ -78,12 +78,10 @@ void singlePageOfIssues() {
78
78
79
79
@ Test
80
80
void multiplePagesOfIssues () {
81
- HttpHeaders headers = new HttpHeaders ();
82
- headers .set ("Link" , "<page-two>; rel=\" next\" " );
83
81
this .server .expect (requestTo ("https://api.github.com/repos/org/repo/issues" ))
84
82
.andExpect (method (HttpMethod .GET ))
85
83
.andExpect (basicAuth ())
86
- .andRespond (withResource ("issues-page-one.json" , "Link:<page-two>; rel=\" next\" " ));
84
+ .andRespond (withResource ("issues-page-one.json" , "Link:</ page-two>; rel=\" next\" " ));
87
85
this .server .expect (requestTo ("/page-two" ))
88
86
.andExpect (method (HttpMethod .GET ))
89
87
.andExpect (basicAuth ())
@@ -95,6 +93,23 @@ void multiplePagesOfIssues() {
95
93
assertThat (pageTwo .getContent ()).hasSize (15 );
96
94
}
97
95
96
+ @ Test
97
+ void multiplePagesOfIssuesWithPercentEncodedLink () {
98
+ this .server .expect (requestTo ("https://api.github.com/repos/org/repo/issues" ))
99
+ .andExpect (method (HttpMethod .GET ))
100
+ .andExpect (basicAuth ())
101
+ .andRespond (withResource ("issues-page-one.json" , "Link:</page-two%3D%3D>; rel=\" next\" " ));
102
+ this .server .expect (requestTo ("/page-two%3D%3D" ))
103
+ .andExpect (method (HttpMethod .GET ))
104
+ .andExpect (basicAuth ())
105
+ .andRespond (withResource ("issues-page-two.json" ));
106
+ Page <Issue > pageOne = this .gitHub .getIssues ("org" , "repo" );
107
+ assertThat (pageOne .getContent ()).hasSize (15 );
108
+ Page <Issue > pageTwo = pageOne .next ();
109
+ assertThat (pageTwo ).isNotNull ();
110
+ assertThat (pageTwo .getContent ()).hasSize (15 );
111
+ }
112
+
98
113
@ Test
99
114
void rateLimited () {
100
115
long reset = System .currentTimeMillis ();
@@ -117,7 +132,7 @@ void noComments() {
117
132
.andExpect (basicAuth ())
118
133
.andRespond (withSuccess ("[]" , MediaType .APPLICATION_JSON ));
119
134
Page <Comment > comments = this .gitHub
120
- .getComments (new Issue (null , "commentsUrl" , null , null , null , null , null , null ));
135
+ .getComments (new Issue (null , "/ commentsUrl" , null , null , null , null , null , null ));
121
136
assertThat (comments .getContent ()).isEmpty ();
122
137
assertThat (comments .next ()).isNull ();
123
138
}
@@ -129,7 +144,7 @@ void singlePageOfComments() {
129
144
.andExpect (basicAuth ())
130
145
.andRespond (withResource ("comments-page-one.json" ));
131
146
Page <Comment > comments = this .gitHub
132
- .getComments (new Issue (null , "commentsUrl" , null , null , null , null , null , null ));
147
+ .getComments (new Issue (null , "/ commentsUrl" , null , null , null , null , null , null ));
133
148
assertThat (comments .getContent ()).hasSize (17 );
134
149
assertThat (comments .next ()).isNull ();
135
150
}
@@ -141,13 +156,13 @@ void multiplePagesOfComments() {
141
156
this .server .expect (requestTo ("/commentsUrl" ))
142
157
.andExpect (method (HttpMethod .GET ))
143
158
.andExpect (basicAuth ())
144
- .andRespond (withResource ("comments-page-one.json" , "Link:<page-two>; rel=\" next\" " ));
159
+ .andRespond (withResource ("comments-page-one.json" , "Link:</ page-two>; rel=\" next\" " ));
145
160
this .server .expect (requestTo ("/page-two" ))
146
161
.andExpect (method (HttpMethod .GET ))
147
162
.andExpect (basicAuth ())
148
163
.andRespond (withResource ("comments-page-two.json" ));
149
164
Page <Comment > pageOne = this .gitHub
150
- .getComments (new Issue (null , "commentsUrl" , null , null , null , null , null , null ));
165
+ .getComments (new Issue (null , "/ commentsUrl" , null , null , null , null , null , null ));
151
166
assertThat (pageOne .getContent ()).hasSize (17 );
152
167
Page <Comment > pageTwo = pageOne .next ();
153
168
assertThat (pageTwo ).isNotNull ();
@@ -206,24 +221,22 @@ void singlePageOfEvents() {
206
221
.andExpect (method (HttpMethod .GET ))
207
222
.andExpect (basicAuth ())
208
223
.andRespond (withResource ("events-page-one.json" ));
209
- Page <Event > events = this .gitHub .getEvents (new Issue (null , null , "eventsUrl" , null , null , null , null , null ));
224
+ Page <Event > events = this .gitHub .getEvents (new Issue (null , null , "/ eventsUrl" , null , null , null , null , null ));
210
225
assertThat (events .getContent ()).hasSize (12 );
211
226
assertThat (events .next ()).isNull ();
212
227
}
213
228
214
229
@ Test
215
230
void multiplePagesOfEvents () {
216
- HttpHeaders headers = new HttpHeaders ();
217
- headers .set ("Link" , "<page-two>; rel=\" next\" " );
218
231
this .server .expect (requestTo ("/eventsUrl" ))
219
232
.andExpect (method (HttpMethod .GET ))
220
233
.andExpect (basicAuth ())
221
- .andRespond (withResource ("events-page-one.json" , "Link:<page-two>; rel=\" next\" " ));
234
+ .andRespond (withResource ("events-page-one.json" , "Link:</ page-two>; rel=\" next\" " ));
222
235
this .server .expect (requestTo ("/page-two" ))
223
236
.andExpect (method (HttpMethod .GET ))
224
237
.andExpect (basicAuth ())
225
238
.andRespond (withResource ("events-page-two.json" ));
226
- Page <Event > pageOne = this .gitHub .getEvents (new Issue (null , null , "eventsUrl" , null , null , null , null , null ));
239
+ Page <Event > pageOne = this .gitHub .getEvents (new Issue (null , null , "/ eventsUrl" , null , null , null , null , null ));
227
240
assertThat (pageOne .getContent ()).hasSize (12 );
228
241
Page <Event > pageTwo = pageOne .next ();
229
242
assertThat (pageTwo ).isNotNull ();
0 commit comments