use of net.sourceforge.pmd.cache.FileAnalysisCache in project pmd by pmd.
the class ConfigurationTest method testAnalysisCache.
@Test
public void testAnalysisCache() throws IOException {
final PMDConfiguration configuration = new PMDConfiguration();
assertNotNull("Default cache is null", configuration.getAnalysisCache());
assertTrue("Default cache is not a noop", configuration.getAnalysisCache() instanceof NoopAnalysisCache);
configuration.setAnalysisCache(null);
assertNotNull("Default cache was set to null", configuration.getAnalysisCache());
final File cacheFile = File.createTempFile("pmd-", ".cache");
cacheFile.deleteOnExit();
final FileAnalysisCache analysisCache = new FileAnalysisCache(cacheFile);
configuration.setAnalysisCache(analysisCache);
assertSame("Confgured cache not stored", analysisCache, configuration.getAnalysisCache());
}
use of net.sourceforge.pmd.cache.FileAnalysisCache in project pmd by pmd.
the class ConfigurationTest method testIgnoreIncrementalAnalysis.
@Test
public void testIgnoreIncrementalAnalysis() throws IOException {
final PMDConfiguration configuration = new PMDConfiguration();
// set dummy cache location
final File cacheFile = File.createTempFile("pmd-", ".cache");
cacheFile.deleteOnExit();
final FileAnalysisCache analysisCache = new FileAnalysisCache(cacheFile);
configuration.setAnalysisCache(analysisCache);
assertNotNull("Null cache location accepted", configuration.getAnalysisCache());
assertFalse("Non null cache location, cache should not be noop", configuration.getAnalysisCache() instanceof NoopAnalysisCache);
configuration.setIgnoreIncrementalAnalysis(true);
assertTrue("Ignoring incremental analysis should turn the cache into a noop", configuration.getAnalysisCache() instanceof NoopAnalysisCache);
}
Aggregations