Skip to content

Commit 83f0cf2

Browse files
committed
Collection: assert pagination headers
1 parent d75fdd8 commit 83f0cf2

2 files changed

Lines changed: 28 additions & 9 deletions

File tree

src/test/java/com/uwetrottmann/trakt5/services/SyncTest.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,24 @@ private void assertLastActivityUpdated(LastActivityUpdated activity) {
186186

187187
@Test
188188
public void test_collectionMovies() throws IOException {
189-
List<BaseMovie> movies = executeCall(getTrakt().sync().collectionMovies(1, 1000, null));
190-
assertSyncMovies(movies, "collection");
189+
int page = 1;
190+
int limit = 1000;
191+
Response<List<BaseMovie>> response = executeCallWithoutReadingBody(
192+
getTrakt().sync().collectionMovies(page, limit, null));
193+
194+
assertPaginationHeaders(response, page, limit);
195+
assertSyncMovies(response.body(), "collection");
191196
}
192197

193198
@Test
194199
public void test_collectionShows() throws IOException {
195-
List<BaseShow> shows = executeCall(getTrakt().sync().collectionShows(1, 1000, null));
196-
assertSyncShows(shows, "collection");
200+
int page = 1;
201+
int limit = 1000;
202+
Response<List<BaseShow>> response = executeCallWithoutReadingBody(
203+
getTrakt().sync().collectionShows(page, limit, null));
204+
205+
assertPaginationHeaders(response, page, limit);
206+
assertSyncShows(response.body(), "collection");
197207
}
198208

199209
@Test

src/test/java/com/uwetrottmann/trakt5/services/UsersTest.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,24 @@ public void test_profile() throws IOException {
104104

105105
@Test
106106
public void test_collectionMovies() throws IOException {
107-
List<BaseMovie> movies = executeCall(
108-
getTrakt().users().collectionMovies(TestData.USER_SLUG, 1, 1000, null));
109-
assertSyncMovies(movies, "collection");
107+
int page = 1;
108+
int limit = 1000;
109+
Response<List<BaseMovie>> response = executeCallWithoutReadingBody(
110+
getTrakt().users().collectionMovies(TestData.USER_SLUG, page, limit, null));
111+
112+
assertPaginationHeaders(response, page, limit);
113+
assertSyncMovies(response.body(), "collection");
110114
}
111115

112116
@Test
113117
public void test_collectionShows() throws IOException {
114-
List<BaseShow> shows = executeCall(getTrakt().users().collectionShows(TestData.USER_SLUG, 1, 1000, null));
115-
assertSyncShows(shows, "collection");
118+
int page = 1;
119+
int limit = 1000;
120+
Response<List<BaseShow>> response = executeCallWithoutReadingBody(
121+
getTrakt().users().collectionShows(TestData.USER_SLUG, page, limit, null));
122+
123+
assertPaginationHeaders(response, page, limit);
124+
assertSyncShows(response.body(), "collection");
116125
}
117126

118127
@Test

0 commit comments

Comments
 (0)