SearchTaskFactory { public List<SearchTask> buildSubsearchTasks(SearchResult searchResult) { return this.spawnedSearchTaskBuilder.getSearchTasks(searchResult); } SearchTaskFactory(InitialSearchTaskBuilder initialSearchTaskBuilder,
      SpawnedSearchTaskBuilder spawnedSearchTaskBuilder); List<SearchTask> buildInitialSearchTasks(SearchPolicy searchPolicy, LocationTokens locationTokens); List<SearchTask> buildSubsearchTasks(SearchResult searchResult);  }
@Test public void testBuildSubsearchTasks() { SearchResult searchResult = new SearchResult(searchPolicy, locationTokens); Mockito.when(spawnedSearchTaskBuilder.getSearchTasks(searchResult)).thenReturn(expectedTasks); List<SearchTask> result = searchTaskFactory.buildSubsearchTasks(searchResult); assertThat(result).isSameAs(expectedTasks); }