use of org.nzbhydra.searching.IndexerSearchResult in project nzbhydra2 by theotherp.
the class BinsearchTest method shouldRecognizeIfSingleResultPage.
@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++) {
items.add(new SearchResultItem());
}
indexerSearchResult.setSearchResultItems(items);
testee.completeIndexerSearchResult(html, indexerSearchResult, null, searchRequest);
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));
}
use of org.nzbhydra.searching.IndexerSearchResult in project nzbhydra2 by theotherp.
the class BinsearchTest method shouldRecognizeIfMoreResultsAvailable.
@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);
assertThat(indexerSearchResult.isTotalResultsKnown(), is(false));
assertThat(indexerSearchResult.isHasMoreResults(), is(true));
}
Aggregations