Source:
<code>public void testClearExistingCache() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HiddenFieldCheck.class); final DefaultConfiguration treeWalkerConfig = createCheckConfig(TreeWalker.class); treeWalkerConfig.addChild(checkConfig); final DefaultConfiguration checkerConfig = new DefaultConfiguration("myConfig"); checkerConfig.addAttribute("charset", "UTF-8"); checkerConfig.addChild(treeWalkerConfig); final File cacheFile = temporaryFolder.newFile(); checkerConfig.addAttribute("cacheFile", cacheFile.getPath()); final Checker checker = new Checker(); checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader()); checker.configure(checkerConfig); checker.addListener(new BriefUtLogger(stream)); final String pathToEmptyFile = temporaryFolder.newFile("file.java").getPath(); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checker, pathToEmptyFile, pathToEmptyFile, expected); checker.clearCache(); checker.destroy(); final Properties cacheAfterClear = new Properties(); cacheAfterClear.load(Files.newBufferedReader(cacheFile.toPath())); assertEquals(1, cacheAfterClear.size()); assertNotNull(cacheAfterClear.getProperty(PropertyCacheFile.CONFIG_HASH_KEY)); <START> <END> verify(checker, pathToEmptyFile, pathToEmptyFile, expected); final Properties cacheAfterSecondRun = new Properties(); cacheAfterSecondRun.load(Files.newBufferedReader(cacheFile.toPath())); assertNotNull(cacheAfterSecondRun.getProperty(pathToEmptyFile)); assertEquals( cacheAfterClear.getProperty(PropertyCacheFile.CONFIG_HASH_KEY), cacheAfterSecondRun.getProperty(PropertyCacheFile.CONFIG_HASH_KEY) ); final int expectedNumberOfObjectsInCacheAfterSecondRun = 2; assertEquals(expectedNumberOfObjectsInCacheAfterSecondRun, cacheAfterSecondRun.size()); }</code><technical_language>call verify if clear cache right checking anything? other removed some special reason is needed</technical_language>

Target:
public void testClearExistingCache() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(HiddenFieldCheck.class); final DefaultConfiguration treeWalkerConfig = createCheckConfig(TreeWalker.class); treeWalkerConfig.addChild(checkConfig); final DefaultConfiguration checkerConfig = new DefaultConfiguration("myConfig"); checkerConfig.addAttribute("charset", "UTF-8"); checkerConfig.addChild(treeWalkerConfig); final File cacheFile = temporaryFolder.newFile(); checkerConfig.addAttribute("cacheFile", cacheFile.getPath()); final Checker checker = new Checker(); checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader()); checker.configure(checkerConfig); checker.addListener(new BriefUtLogger(stream)); checker.clearCache(); checker.destroy(); final Properties cacheAfterClear = new Properties(); cacheAfterClear.load(Files.newBufferedReader(cacheFile.toPath())); assertEquals(1, cacheAfterClear.size()); assertNotNull(cacheAfterClear.getProperty(PropertyCacheFile.CONFIG_HASH_KEY)); final String pathToEmptyFile = temporaryFolder.newFile("file.java").getPath(); final String[] expected = CommonUtils.EMPTY_STRING_ARRAY; verify(checker, pathToEmptyFile, pathToEmptyFile, expected); final Properties cacheAfterSecondRun = new Properties(); cacheAfterSecondRun.load(Files.newBufferedReader(cacheFile.toPath())); assertNotNull(cacheAfterSecondRun.getProperty(pathToEmptyFile)); assertEquals( cacheAfterClear.getProperty(PropertyCacheFile.CONFIG_HASH_KEY), cacheAfterSecondRun.getProperty(PropertyCacheFile.CONFIG_HASH_KEY) ); final int expectedNumberOfObjectsInCacheAfterSecondRun = 2; assertEquals(expectedNumberOfObjectsInCacheAfterSecondRun, cacheAfterSecondRun.size()); }