use of com.puppycrawl.tools.checkstyle.ModuleFactory in project checkstyle by checkstyle.
the class XdocsPagesTest method testAllCheckSectionsEx.
/**
* Test contains asserts in callstack, but idea does not see them.
*
* @noinspection JUnitTestMethodWithNoAssertions
*/
@Test
public void testAllCheckSectionsEx() throws Exception {
final ModuleFactory moduleFactory = TestUtil.getPackageObjectFactory();
final Path path = Paths.get(XdocUtil.DIRECTORY_PATH + "/config.xml");
final String fileName = path.getFileName().toString();
final String input = Files.readString(path);
final Document document = XmlUtil.getRawXml(fileName, input, input);
final NodeList sources = document.getElementsByTagName("section");
for (int position = 0; position < sources.getLength(); position++) {
final Node section = sources.item(position);
final String sectionName = XmlUtil.getNameAttributeOfNode(section);
if (!"Checker".equals(sectionName) && !"TreeWalker".equals(sectionName)) {
continue;
}
validateCheckSection(moduleFactory, fileName, sectionName, section);
}
}
use of com.puppycrawl.tools.checkstyle.ModuleFactory in project checkstyle by checkstyle.
the class XdocsJavaDocsTest method testAllCheckSectionJavaDocs.
/**
* Test contains asserts in callstack, but idea does not see them.
*
* @noinspection JUnitTestMethodWithNoAssertions
*/
@Test
public void testAllCheckSectionJavaDocs() throws Exception {
final ModuleFactory moduleFactory = TestUtil.getPackageObjectFactory();
for (Path path : XdocUtil.getXdocsConfigFilePaths(XdocUtil.getXdocsFilePaths())) {
final File file = path.toFile();
final String fileName = file.getName();
if ("config_system_properties.xml".equals(fileName)) {
continue;
}
final String input = Files.readString(path);
final Document document = XmlUtil.getRawXml(fileName, input, input);
final NodeList sources = document.getElementsByTagName("section");
for (int position = 0; position < sources.getLength(); position++) {
final Node section = sources.item(position);
final String sectionName = XmlUtil.getNameAttributeOfNode(section);
if ("Content".equals(sectionName) || "Overview".equals(sectionName)) {
continue;
}
examineCheckSection(moduleFactory, fileName, sectionName, section);
}
}
}
Aggregations