### Question:
Binsearch extends Indexer<String> { @Override protected void completeIndexerSearchResult(String response, IndexerSearchResult indexerSearchResult, AcceptorResult acceptorResult, SearchRequest searchRequest, int offset, Integer limit) { Document doc = Jsoup.parse(response); if (doc.select("table.xMenuT").size() > 0) { Element navigationTable = doc.select("table.xMenuT").get(1); Elements pageLinks = navigationTable.select("a"); boolean hasMore = !pageLinks.isEmpty() && pageLinks.last().text().equals(">"); boolean totalKnown = false; indexerSearchResult.setOffset(searchRequest.getOffset()); int total = searchRequest.getOffset() + 100; if (!hasMore) { total = searchRequest.getOffset() + indexerSearchResult.getSearchResultItems().size(); totalKnown = true; } indexerSearchResult.setHasMoreResults(hasMore); indexerSearchResult.setTotalResults(total); indexerSearchResult.setTotalResultsKnown(totalKnown); } else { indexerSearchResult.setHasMoreResults(false); indexerSearchResult.setTotalResults(0); indexerSearchResult.setTotalResultsKnown(true); } indexerSearchResult.setLimit(limit); indexerSearchResult.setOffset(offset); }  @Override NfoResult getNfo(String guid);  }### Answer:
@Test public void shouldRecognizeIfSingleResultPage() throws Exception { SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100); String html = Resources.toString(Resources.getResource(BinsearchTest.class, "/org/nzbhydra/mapping/binsearch_singlepage.html"), Charsets.UTF_8); IndexerSearchResult indexerSearchResult = new IndexerSearchResult(testee, ""); List<SearchResultItem> items = new ArrayList<>(); for (int i = 0; i < 24; i++) { SearchResultItem searchResultItem = new SearchResultItem(); searchResultItem.setPubDate(Instant.now()); items.add(searchResultItem); } indexerSearchResult.setSearchResultItems(items); testee.completeIndexerSearchResult(html, indexerSearchResult, null, searchRequest, 0, 100); assertThat(indexerSearchResult.getOffset(), is(0)); assertThat(indexerSearchResult.getLimit(), is(100)); assertThat(indexerSearchResult.getTotalResults(), is(24)); assertThat(indexerSearchResult.isTotalResultsKnown(), is(true)); assertThat(indexerSearchResult.isHasMoreResults(), is(false)); }
@Test public void shouldRecognizeIfMoreResultsAvailable() throws Exception { SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100); String html = Resources.toString(Resources.getResource(BinsearchTest.class, "/org/nzbhydra/mapping/binsearch.html"), Charsets.UTF_8); IndexerSearchResult indexerSearchResult = new IndexerSearchResult(testee, ""); testee.completeIndexerSearchResult(html, indexerSearchResult, null, searchRequest, 0, 100); assertThat(indexerSearchResult.isTotalResultsKnown(), is(false)); assertThat(indexerSearchResult.isHasMoreResults(), is(true)); }