### Question:
SearchExecutor { public void performSearch() { performSearch(myModel.getSelectedSearchTypes()); } SearchExecutor(SearchModel model, SearchRegistry searchRegistry, TimeManager timeManager, MapManager mapManager); void performSearch(); void performSearch(Collection<String> types); void clearSearch();  }### Answer:
@Test public void testPerformSearch() throws InterruptedException { EasyMockSupport support = new EasyMockSupport(); List<String> searchTypes = New.list("Place Names", "Layers"); TimeSpan expectedSpan = TimeSpan.get(System.currentTimeMillis() - 1000, System.currentTimeMillis()); SearchResult result1 = support.createMock(SearchResult.class); result1.setSearchType(searchTypes.get(0)); SearchResult result2 = support.createMock(SearchResult.class); result2.setSearchType(searchTypes.get(0)); SearchRegistry searchRegistry = createSearchRegistry(support, "acka acka", searchTypes, expectedSpan, New.list(result1, result2)); ObservableList<TimeSpan> loadSpans = new ObservableList<>(); loadSpans.add(expectedSpan); TimeManager timeManager = createTimeManager(support, loadSpans); MapManager mapManager = createMapManager(support); CountDownLatch latch = new CountDownLatch(1); SearchModel model = new SearchModel(); model.getKeyword().set("acka acka"); model.getSelectedSearchTypes().addAll(searchTypes); model.getAllResults().addListener((ListChangeListener<SearchResult>)(e) -> { latch.countDown(); }); support.replayAll(); SearchExecutor executor = new SearchExecutor(model, searchRegistry, timeManager, mapManager); executor.performSearch(); assertTrue(latch.await(1, TimeUnit.SECONDS)); assertTrue(model.getAllResults().contains(result1)); assertTrue(model.getAllResults().contains(result2)); support.verifyAll(); }
@Test public void testPerformSearchNullDoubleSpan() throws InterruptedException { EasyMockSupport support = new EasyMockSupport(); List<String> searchTypes = New.list("Place Names", "Layers"); TimeSpan loadSpan1 = TimeSpan.get(System.currentTimeMillis() - 1000, System.currentTimeMillis()); TimeSpan loadSpan2 = TimeSpan.get(System.currentTimeMillis() - 10000, System.currentTimeMillis() - 9000); TimeSpan expectedSpan = TimeSpan.get(loadSpan2.getStart(), loadSpan1.getEnd()); SearchResult result1 = support.createMock(SearchResult.class); result1.setSearchType(searchTypes.get(0)); SearchResult result2 = support.createMock(SearchResult.class); result2.setSearchType(searchTypes.get(0)); SearchRegistry searchRegistry = createSearchRegistry(support, null, searchTypes, expectedSpan, New.list(result1, result2)); ObservableList<TimeSpan> loadSpans = new ObservableList<>(); loadSpans.add(loadSpan1); loadSpans.add(loadSpan2); TimeManager timeManager = createTimeManager(support, loadSpans); MapManager mapManager = createMapManager(support); CountDownLatch latch = new CountDownLatch(1); SearchModel model = new SearchModel(); model.getSelectedSearchTypes().addAll(searchTypes); model.getAllResults().addListener((ListChangeListener<SearchResult>)(e) -> { latch.countDown(); }); support.replayAll(); SearchExecutor executor = new SearchExecutor(model, searchRegistry, timeManager, mapManager); executor.performSearch(); assertTrue(latch.await(1, TimeUnit.SECONDS)); assertTrue(model.getAllResults().contains(result1)); assertTrue(model.getAllResults().contains(result2)); support.verifyAll(); }