### Question:
SearchController { public void performSearch() { if (mySearchTypeListener == null) { mySearchTypeListener = this::onSearchTypesChanged; myModel.getSelectedSearchTypes().addListener(mySearchTypeListener); } clearSearch(); mySearcher.performSearch(); } SearchController(Toolbox toolbox, SearchModel searchModel); void close(); void performSearch(); void setDialogVisible(boolean visible);  }### Answer:
@Test public void testPerformSearch() throws InterruptedException { EasyMockSupport support = new EasyMockSupport(); myPublishedGeometries.clear(); TimeSpan expectedSpan = TimeSpan.get(System.currentTimeMillis() - 10000, System.currentTimeMillis()); SearchResult result1 = new SearchResult(); result1.setText("I am a place name"); result1.setConfidence(.4f); result1.getLocations().add(LatLonAlt.createFromDegrees(10, 11)); SearchResult result2 = new SearchResult(); result2.setText("I am a layer"); result2.setConfidence(.9f); result2.getLocations().add(LatLonAlt.createFromDegrees(12, 13)); Set<String> selectedSearchTypes = New.set(ourLayersType, ourPlaceNameType); Map<String, Map<String, SearchProvider>> providers = createProviders(support, ourKeyWord, expectedSpan, result1, result2, selectedSearchTypes); TimeManager timeManager = createTimeManager(support, expectedSpan); SearchRegistry searchRegistry = createSearchRegistry(support, providers); Toolbox toolbox = createToolbox(support, searchRegistry, timeManager); CountDownLatch latch = new CountDownLatch(2); final SearchModel model = new SearchModel(); model.getShownResults().addListener((ListChangeListener<SearchResult>)(c) -> { while (c.next()) { for (int i = 0; i < c.getAddedSize(); i++) { latch.countDown(); } } }); support.replayAll(); SearchController controller = new SearchController(toolbox, model); model.getSearchTypes().add(ourLayersType); model.getSearchTypes().add(ourPlaceNameType); model.getSelectedSearchTypes().add(ourLayersType); model.getSelectedSearchTypes().add(ourPlaceNameType); model.getSearchTypes().addListener((ListChangeListener<String>)(change) -> { assertTrue(model.getSelectedSearchTypes().containsAll(model.getSearchTypes())); }); model.getKeyword().set(ourKeyWord); assertEquals(ourLayersType, model.getSearchTypes().get(0)); assertEquals(ourPlaceNameType, model.getSearchTypes().get(1)); assertEquals(ourLayersType, model.getSelectedSearchTypes().get(0)); assertEquals(ourPlaceNameType, model.getSelectedSearchTypes().get(1)); assertTrue(latch.await(1, TimeUnit.SECONDS)); assertTrue(model.getAllResults().contains(result1)); assertEquals(result1, model.getShownResults().get(1)); assertTrue(model.getAllResults().contains(result2)); assertEquals(result2, model.getShownResults().get(0)); assertEquals(4, myPublishedGeometries.size()); Set<LatLonAlt> points = New.set(); points.add(((GeographicPosition)((PointGeometry)myPublishedGeometries.get(0)).getPosition()).getLatLonAlt()); points.add(((GeographicPosition)((PointGeometry)myPublishedGeometries.get(2)).getPosition()).getLatLonAlt()); assertTrue(points.contains(result1.getLocations().get(0))); assertTrue(points.contains(result2.getLocations().get(0))); controller.close(); support.verifyAll(); }