use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class PropertyCacheFileTest method testConfigHashRemainsOnResetExternalResources.
@Test
public void testConfigHashRemainsOnResetExternalResources() throws IOException {
final Configuration config = new DefaultConfiguration("myName");
final String filePath = temporaryFolder.newFile().getPath();
final PropertyCacheFile cache = new PropertyCacheFile(config, filePath);
// create cache with one file
cache.load();
cache.put("myFile", 1);
final String hash = cache.get(PropertyCacheFile.CONFIG_HASH_KEY);
assertNotNull(hash);
// apply new external resource to clear cache
final Set<String> resources = new HashSet<>();
resources.add("dummy");
cache.putExternalResources(resources);
assertEquals(hash, cache.get(PropertyCacheFile.CONFIG_HASH_KEY));
assertFalse(cache.isInCache("myFile", 1));
}
use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class PropertyCacheFileTest method testCtor.
@Test
public void testCtor() {
try {
new PropertyCacheFile(null, "");
} catch (IllegalArgumentException ex) {
assertEquals("config can not be null", ex.getMessage());
}
try {
final Configuration config = new DefaultConfiguration("myName");
new PropertyCacheFile(config, null);
} catch (IllegalArgumentException ex) {
assertEquals("fileName can not be null", ex.getMessage());
}
}
use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class PropertyCacheFileTest method testInCache.
@Test
public void testInCache() throws IOException {
final Configuration config = new DefaultConfiguration("myName");
final String filePath = temporaryFolder.newFile().getPath();
final PropertyCacheFile cache = new PropertyCacheFile(config, filePath);
cache.put("myFile", 1);
assertTrue(cache.isInCache("myFile", 1));
assertFalse(cache.isInCache("myFile", 2));
assertFalse(cache.isInCache("myFile1", 1));
}
use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class JavadocPackageCheckTest method testHtmlDisallowed.
@Test
public void testHtmlDisallowed() throws Exception {
final Configuration checkConfig = createCheckConfig(JavadocPackageCheck.class);
final String[] expected = { "0: " + getCheckMessage(MSG_PACKAGE_INFO) };
verify(createChecker(checkConfig), getPath("pkghtml" + File.separator + "InputIgnored.java"), getPath("pkghtml" + File.separator + "InputIgnored.java"), expected);
}
use of com.puppycrawl.tools.checkstyle.api.Configuration in project checkstyle by checkstyle.
the class JavadocPackageCheckTest method testBoth.
@Test
public void testBoth() throws Exception {
final Configuration checkConfig = createCheckConfig(JavadocPackageCheck.class);
final String[] expected = { "0: " + getCheckMessage(MSG_LEGACY_PACKAGE_HTML) };
verify(createChecker(checkConfig), getPath("bothfiles" + File.separator + "InputIgnored.java"), getPath("bothfiles" + File.separator + "InputIgnored.java"), expected);
}
Aggregations