public void testSearchUsingTagsAndOffset() throws Throwable { // TODO: Ideally this should be mocked, so testing doesn't rely on external APIs. // Create a new client connected to the Danbooru API. final SearchClient client = createSearchClient(); // Retrieve search results. final SearchResult page1 = client.search(getDefaultTag(), 0); final SearchResult page2 = client.search(getDefaultTag(), 1); // Make sure that the results differ. assertThat(page1.getImages()).isNotEmpty(); assertThat(page2.getImages()).isNotEmpty(); assertThat(page2.getCurrentOffset()).isEqualTo(1); assertThat(page1.getImages()[0].id).isNotEqualTo(page2.getImages()[0].id); assertThat(page1.getImages()[0].searchPage).isEqualTo(page1.getCurrentOffset()); assertThat(page1.getImages()[0].searchPagePosition).isEqualTo(0); assertThat(page1.getImages()[1].searchPagePosition).isEqualTo(1); assertThat(page2.getImages()[0].searchPage).isEqualTo(page2.getCurrentOffset()); assertThat(page2.getImages()[0].searchPagePosition).isEqualTo(0); assertThat(page2.getImages()[1].searchPagePosition).isEqualTo(1); }