Add failing test for non-existing entries in classpath

This commit is contained in:
Juan Martín Sotuyo Dodero
2019-08-15 14:33:35 -03:00
parent fac5604d63
commit 032acbd65d

View File

@ -215,6 +215,20 @@ public class FileAnalysisCacheTest {
reloadedCache.isUpToDate(sourceFile));
}
@Test
public void testClasspathNonExistingEntryIsIgnored() throws MalformedURLException, IOException {
final RuleSets rs = mock(RuleSets.class);
final ClassLoader cl = mock(ClassLoader.class);
System.setProperty("java.class.path", System.getProperty("java.class.path") + File.pathSeparator
+ tempFolder.getRoot().getAbsolutePath() + File.separator + "non-existing-dir");
final FileAnalysisCache reloadedCache = new FileAnalysisCache(newCacheFile);
reloadedCache.checkValidity(rs, cl);
assertFalse("Cache believes cache is up to date when the classpath changed",
reloadedCache.isUpToDate(sourceFile));
}
@Test
public void testClasspathChangeInvalidatesCache() throws MalformedURLException, IOException {
final RuleSets rs = mock(RuleSets.class);