aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorrnveach <rveach02@gmail.com>2016-05-15 11:14:17 -0400
committerrnveach <rveach02@gmail.com>2016-05-27 09:42:49 -0400
commit39b343a32a4f1ce18ee98a34618fda0a5404d6a0 (patch)
tree4bb62d3ec030aa1d1b7f21eebb34572f411ccbc6 /src/test
parent2483ddc5a4d286891da1922cadf9e66547a7ec48 (diff)
downloadcheckstyle-39b343a32a4f1ce18ee98a34618fda0a5404d6a0.tar.gz
Issue #3143: forbid empty return statements and fixed violations
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/puppycrawl/tools/checkstyle/internal/XDocsPagesTest.java51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XDocsPagesTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XDocsPagesTest.java
index 689d9c88a..f46047964 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/internal/XDocsPagesTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/internal/XDocsPagesTest.java
@@ -216,38 +216,37 @@ public class XDocsPagesTest {
private static void validateCheckstyleXml(String fileName, String code,
String unserializedSource) throws IOException {
// can't process non-existent examples, or out of context snippets
- if (code.contains("com.mycompany") || code.contains("checkstyle-packages")
- || code.contains("MethodLimit") || code.contains("<suppress ")
- || code.contains("<import-control ") || unserializedSource.startsWith("<property ")
- || unserializedSource.startsWith("<taskdef ")) {
- return;
- }
-
- // validate checkstyle structure and contents
- try {
- final Properties properties = new Properties();
+ if (!code.contains("com.mycompany") && !code.contains("checkstyle-packages")
+ && !code.contains("MethodLimit") && !code.contains("<suppress ")
+ && !code.contains("<import-control ")
+ && !unserializedSource.startsWith("<property ")
+ && !unserializedSource.startsWith("<taskdef ")) {
+ // validate checkstyle structure and contents
+ try {
+ final Properties properties = new Properties();
- properties.setProperty("checkstyle.header.file",
- new File("config/java.header").getCanonicalPath());
+ properties.setProperty("checkstyle.header.file",
+ new File("config/java.header").getCanonicalPath());
- final PropertiesExpander expander = new PropertiesExpander(properties);
- final Configuration config = ConfigurationLoader.loadConfiguration(new InputSource(
- new StringReader(code)), expander, false);
- final Checker checker = new Checker();
+ final PropertiesExpander expander = new PropertiesExpander(properties);
+ final Configuration config = ConfigurationLoader.loadConfiguration(new InputSource(
+ new StringReader(code)), expander, false);
+ final Checker checker = new Checker();
- try {
- final ClassLoader moduleClassLoader = Checker.class.getClassLoader();
- checker.setModuleClassLoader(moduleClassLoader);
- checker.configure(config);
+ try {
+ final ClassLoader moduleClassLoader = Checker.class.getClassLoader();
+ checker.setModuleClassLoader(moduleClassLoader);
+ checker.configure(config);
+ }
+ finally {
+ checker.destroy();
+ }
}
- finally {
- checker.destroy();
+ catch (CheckstyleException ex) {
+ Assert.fail(fileName + " has invalid Checkstyle xml (" + ex.getMessage() + "): "
+ + unserializedSource);
}
}
- catch (CheckstyleException ex) {
- Assert.fail(fileName + " has invalid Checkstyle xml (" + ex.getMessage() + "): "
- + unserializedSource);
- }
}
@Test