### Question:
VariableSearchService implements LiveSearchService<String> { public void clear() { options.clear(); typesMetadata.clear(); optionType.clear(); } @Inject  VariableSearchService(final ConditionEditorMetadataService metadataService,
                                 final ClientTranslationService translationService); void init(ClientSession session); @Override void search(String pattern, int maxResults, LiveSearchCallback<String> callback); @Override void searchEntry(String key, LiveSearchCallback<String> callback); String getOptionType(String key); void clear();  }### Answer:
@Test @SuppressWarnings("unchecked") public void testClear() { prepareAndInitSession(); List<Pair<String, String>> expectedVariables = buildExpectedVariableNames(MULTIPLE_INSTANCE_SUBPROCESS, 17); for (int i = 0; i < expectedVariables.size(); i++) { searchService.searchEntry(expectedVariables.get(i).getK1(), searchCallback); verify(searchCallback, times(i + 1)).afterSearch(searchResultsCaptor.capture()); verifyContains(searchResultsCaptor.getValue(), expectedVariables.get(i)); assertEquals(mockedVariableTypes.get(expectedVariables.get(i).getK1()), searchService.getOptionType(expectedVariables.get(i).getK1())); } searchService.clear(); int testedSize = expectedVariables.size(); for (int i = 0; i < expectedVariables.size(); i++) { searchService.searchEntry(expectedVariables.get(i).getK1(), searchCallback); verify(searchCallback, times(i + 1 + testedSize)).afterSearch(searchResultsCaptor.capture()); assertEquals(0, searchResultsCaptor.getValue().size()); assertNull(searchService.getOptionType(expectedVariables.get(i).getK1())); } }