### Question:
HypernymFilterFactory implements TokenFilterFactory { public TokenFilter createTokenFilter(TokenStream tokenStream, Properties properties) throws IOException { String filePath = properties.getProperty(FILE_PATH_PARAMETER); Map<String, List<String>> hypernyms = getHypernyms(filePath); return new HypernymFilter(tokenStream, hypernyms); } HypernymFilterFactory(MultimapFileReaderFactory multimapFileReaderFactory); TokenFilter createTokenFilter(TokenStream tokenStream,
			Properties properties); void preloadResources(Properties properties); Map<String, Map<String, List<String>>> getCachedMappings(); static final String FILE_PATH_PARAMETER; }### Answer:
@Test public void testCreateTokenFilter() throws Exception{ Properties properties = new Properties(); properties.setProperty(HypernymFilterFactory.FILE_PATH_PARAMETER, HYPERNYM_FILE); expect(multimapFileReaderFactory.createMultimapFileReader(HYPERNYM_FILE)).andReturn(multimapFileReader); expect(multimapFileReader.readMultimap()).andReturn(hypernyms); replay(multimapFileReaderFactory); replay(multimapFileReader); HypernymFilter hypernymFilter = (HypernymFilter) hypernymFilterFactory.createTokenFilter(tokenStream, properties); Map<String, Map<String, List<String>>> mappings = hypernymFilterFactory.getCachedMappings(); verify(multimapFileReaderFactory); verify(multimapFileReader); Map<String, List<String>> mapping = mappings.get(HYPERNYM_FILE); assertEquals(hypernyms, mapping); assertEquals(hypernyms, hypernymFilter.getHypernyms()); reset(multimapFileReaderFactory); reset(multimapFileReader); replay(multimapFileReaderFactory); replay(multimapFileReader); hypernymFilter = (HypernymFilter) hypernymFilterFactory.createTokenFilter(tokenStream, properties); verify(multimapFileReaderFactory); verify(multimapFileReader); assertEquals(hypernyms, hypernymFilter.getHypernyms()); }