### Question:
Binsearch extends Indexer<String> { @Override protected UriComponentsBuilder buildSearchUrl(SearchRequest searchRequest, Integer offset, Integer limit) throws IndexerSearchAbortedException { String query = super.generateQueryIfApplicable(searchRequest, ""); query = addRequiredWordsToQuery(searchRequest, query); if (Strings.isNullOrEmpty(query)) { throw new IndexerSearchAbortedException("Binsearch cannot search without a query"); } query = cleanupQuery(query); return UriComponentsBuilder.fromHttpUrl("https: }  @Override NfoResult getNfo(String guid);  }### Answer:
@Test public void shouldBuildSimpleQuery() throws IndexerSearchAbortedException { SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100); searchRequest.setQuery("query"); UriComponentsBuilder builder = testee.buildSearchUrl(searchRequest, 0, 100); assertThat(builder.toUriString(), is("https: }
@Test public void shouldAddRequiredWords() throws IndexerSearchAbortedException { SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100); searchRequest.getInternalData().setRequiredWords(Arrays.asList("a", "b")); searchRequest.setQuery("query"); UriComponentsBuilder builder = testee.buildSearchUrl(searchRequest, 0, 100); assertThat(builder.build().toString(), is("https: }
@Test(expected = IndexerSearchAbortedException.class) public void shouldAbortIfSearchNotPossible() throws IndexerSearchAbortedException { SearchRequest searchRequest = new SearchRequest(SearchSource.INTERNAL, SearchType.SEARCH, 0, 100); testee.buildSearchUrl(searchRequest, 0, 100); }