diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/RuleSetFactoryTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/RuleSetFactoryTest.java
index 877c6c00a5..5d72338d36 100644
--- a/pmd-core/src/test/java/net/sourceforge/pmd/RuleSetFactoryTest.java
+++ b/pmd-core/src/test/java/net/sourceforge/pmd/RuleSetFactoryTest.java
@@ -907,170 +907,290 @@ public class RuleSetFactoryTest {
public void testMissingRuleSetDescriptionIsWarning() throws Exception {
RuleSetReferenceId ref = createRuleSetReferenceId(
"\n" + "\n"
- + " \n"
- + " \n");
+ + " xmlns=\"http://pmd.sourceforge.net/ruleset/2.0.0\"\n"
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ + " xsi:schemaLocation=\"http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd\">\n"
+ + " \n"
+ + " \n");
RuleSetFactory ruleSetFactory = RulesetsFactoryUtils.defaultFactory();
ruleSetFactory.createRuleSet(ref);
assertTrue(logging.getLog().contains("RuleSet description is missing."));
}
- private static final String REF_OVERRIDE_ORIGINAL_NAME = "" + PMD.EOL
- + "" + PMD.EOL + " testdesc" + PMD.EOL + " "
- + PMD.EOL + " " + PMD.EOL + "";
+ private static final String REF_OVERRIDE_ORIGINAL_NAME = "\n"
+ + "\n"
+ + " testdesc\n"
+ + " \n"
+ + "\n"
+ + " \n"
+ + "";
- private static final String REF_MISPELLED_XREF = "" + PMD.EOL + ""
- + PMD.EOL + " testdesc" + PMD.EOL + " " + PMD.EOL + " " + PMD.EOL
- + "";
+ private static final String REF_MISPELLED_XREF = "\n"
+ + "\n"
+ + "\n"
+ + " testdesc\n"
+ + " \n"
+ + " \n"
+ + "";
- private static final String REF_OVERRIDE_ORIGINAL_NAME_ONE_ELEM = "" + PMD.EOL
- + "" + PMD.EOL + " testdesc" + PMD.EOL
- + " "
- + PMD.EOL + "";
+ private static final String REF_OVERRIDE_ORIGINAL_NAME_ONE_ELEM = "\n"
+ + "\n"
+ + " testdesc\n"
+ + " \n"
+ + "\n"
+ + "";
- private static final String REF_OVERRIDE = "" + PMD.EOL + "" + PMD.EOL
- + " testdesc" + PMD.EOL + " " + PMD.EOL
- + " Test description override" + PMD.EOL
- + " Test example override" + PMD.EOL + " 3" + PMD.EOL
- + " " + PMD.EOL
- + " " + PMD.EOL
- + " override3"
- // + PMD.EOL + " " // Nonsense
- + PMD.EOL + " " + PMD.EOL + " " + PMD.EOL + "";
+ private static final String REF_OVERRIDE = "\n"
+ + "\n"
+ + " testdesc\n"
+ + " \n"
+ + " Test description override\n"
+ + " Test example override\n"
+ + " 3\n"
+ + " \n"
+ + " \n"
+ + " override3\n"
+ + "\n"
+ + " \n"
+ + " \n"
+ + "";
- private static final String REF_OVERRIDE_NONEXISTENT = "" + PMD.EOL + "" + PMD.EOL
- + " testdesc" + PMD.EOL + " " + PMD.EOL
- + " Test description override" + PMD.EOL
- + " Test example override" + PMD.EOL + " 3" + PMD.EOL
- + " " + PMD.EOL
- + " " + PMD.EOL // inexistent property
- + " " + PMD.EOL + " " + PMD.EOL + "";
+ private static final String REF_OVERRIDE_NONEXISTENT = "\n"
+ + "\n"
+ + "\n"
+ + " testdesc\n"
+ + " \n"
+ + " Test description override\n"
+ + " Test example override\n"
+ + " 3\n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + " \n"
+ + "";
- private static final String REF_INTERNAL_TO_INTERNAL = "" + PMD.EOL
- + "" + PMD.EOL + " testdesc" + PMD.EOL + "" + PMD.EOL + ""
- + " " + PMD.EOL + "";
+ private static final String REF_INTERNAL_TO_INTERNAL = "\n"
+ + "\n"
+ + " testdesc\n"
+ + "\n"
+ + "\n"
+ + " \n"
+ + "";
- private static final String REF_INTERNAL_TO_INTERNAL_CHAIN = "" + PMD.EOL
- + "" + PMD.EOL + " testdesc" + PMD.EOL + "" + PMD.EOL + ""
- + " 2 " + PMD.EOL
- + " 1 " + PMD.EOL
- + "";
+ private static final String REF_INTERNAL_TO_INTERNAL_CHAIN = "\n"
+ + "\n"
+ + " testdesc\n"
+ + "\n"
+ + "\n"
+ + " 2 \n"
+ + " 1 \n"
+ + "";
- private static final String REF_INTERNAL_TO_EXTERNAL = "" + PMD.EOL
- + "" + PMD.EOL + " testdesc" + PMD.EOL + "" + PMD.EOL
- + " " + PMD.EOL + "";
+ private static final String REF_INTERNAL_TO_EXTERNAL = "\n"
+ + "\n"
+ + " testdesc\n"
+ + "\n"
+ + " \n"
+ + "";
- private static final String REF_INTERNAL_TO_EXTERNAL_CHAIN = "" + PMD.EOL
- + "" + PMD.EOL + " testdesc" + PMD.EOL + "" + PMD.EOL
- + " 2 "
- + PMD.EOL
- + " 1 "
- + PMD.EOL + "";
+ private static final String REF_INTERNAL_TO_EXTERNAL_CHAIN = "\n"
+ + "\n"
+ + " testdesc\n"
+ + "\n"
+ + " 2 \n"
+ + "\n"
+ + " 1 \n"
+ + "\n"
+ + "";
- private static final String EMPTY_RULESET = "" + PMD.EOL + ""
- + PMD.EOL + "testdesc" + PMD.EOL + "";
+ private static final String EMPTY_RULESET = "\n\ntestdesc\n";
- private static final String SINGLE_RULE = "" + PMD.EOL + "" + PMD.EOL
- + "testdesc" + PMD.EOL + ""
- + "3" + PMD.EOL + "";
+ private static final String SINGLE_RULE = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "3\n"
+ + "";
- private static final String MULTIPLE_RULES = "" + PMD.EOL + ""
- + PMD.EOL + "testdesc" + PMD.EOL + ""
- + PMD.EOL + "" + PMD.EOL + ""
- + PMD.EOL + "";
+ private static final String MULTIPLE_RULES = "\n"
+ + "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "";
- private static final String PROPERTIES = "" + PMD.EOL + "" + PMD.EOL
- + "testdesc" + PMD.EOL + ""
- + PMD.EOL + "testdesc2" + PMD.EOL + "" + PMD.EOL
- + "" + PMD.EOL
- + "" + PMD.EOL
- + ""
- + PMD.EOL
- + ""
- + PMD.EOL
- + ""
- + PMD.EOL + "" + PMD.EOL
- + "" + PMD.EOL + "";
+ private static final String PROPERTIES = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "\n"
+ + "testdesc2\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "";
- private static final String XPATH = "" + PMD.EOL + "" + PMD.EOL
- + "testdesc" + PMD.EOL + ""
- + "3" + PMD.EOL + PMD.EOL + "testdesc2" + PMD.EOL
- + "" + PMD.EOL + "" + PMD.EOL
- + "" + PMD.EOL + "" + PMD.EOL + "" + PMD.EOL + "" + PMD.EOL
- + "" + PMD.EOL + "";
+ private static final String XPATH = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "3\n"
+ + "\n"
+ + "testdesc2\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "";
- private static final String PRIORITY = "" + PMD.EOL + "" + PMD.EOL
- + "testdesc" + PMD.EOL + ""
- + "3" + PMD.EOL + "";
+ private static final String PRIORITY = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "3\n"
+ + "";
- private static final String LANGUAGE = "" + PMD.EOL + "" + PMD.EOL
- + "testdesc" + PMD.EOL + "" + PMD.EOL + "";
+ private static final String LANGUAGE = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "";
- private static final String INCORRECT_LANGUAGE = "" + PMD.EOL + ""
- + PMD.EOL + "testdesc" + PMD.EOL + "" + PMD.EOL
- + "";
+ private static final String INCORRECT_LANGUAGE = "\n"
+ + "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "";
- private static final String MINIMUM_LANGUAGE_VERSION = "" + PMD.EOL
- + "" + PMD.EOL + "testdesc" + PMD.EOL + "" + PMD.EOL + "";
+ private static final String MINIMUM_LANGUAGE_VERSION = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "";
- private static final String INCORRECT_MINIMUM_LANGUAGE_VERSION = "" + PMD.EOL
- + "" + PMD.EOL + "testdesc" + PMD.EOL + "" + PMD.EOL + "";
+ private static final String INCORRECT_MINIMUM_LANGUAGE_VERSION = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "";
- private static final String MAXIMUM_LANGUAGE_VERSION = "" + PMD.EOL
- + "" + PMD.EOL + "testdesc" + PMD.EOL + "" + PMD.EOL + "";
+ private static final String MAXIMUM_LANGUAGE_VERSION = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "";
- private static final String INCORRECT_MAXIMUM_LANGUAGE_VERSION = "" + PMD.EOL
- + "" + PMD.EOL + "testdesc" + PMD.EOL + "" + PMD.EOL + "";
+ private static final String INCORRECT_MAXIMUM_LANGUAGE_VERSION = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "";
- private static final String INVERTED_MINIMUM_MAXIMUM_LANGUAGE_VERSIONS = "" + PMD.EOL
- + "" + PMD.EOL + "testdesc" + PMD.EOL + "" + PMD.EOL
- + "";
+ private static final String INVERTED_MINIMUM_MAXIMUM_LANGUAGE_VERSIONS = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "";
- private static final String DIRECT_DEPRECATED_RULE = "" + PMD.EOL + ""
- + PMD.EOL + "testdesc" + PMD.EOL + "" + PMD.EOL + "";
+ private static final String DIRECT_DEPRECATED_RULE = "\n"
+ + "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "";
// Note: Update this RuleSet name to a different RuleSet with deprecated
// Rules when the Rules are finally removed.
@@ -1080,31 +1200,45 @@ public class RuleSetFactoryTest {
// listed here is finally removed.
private static final String DEPRECATED_RULE_NAME = "MockRule3";
- private static final String REFERENCE_TO_DEPRECATED_RULE = "" + PMD.EOL
- + "" + PMD.EOL + "testdesc" + PMD.EOL + "" + PMD.EOL
- + "";
+ private static final String REFERENCE_TO_DEPRECATED_RULE = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n" +
+ "";
- private static final String REFERENCE_TO_RULESET_WITH_DEPRECATED_RULE = "" + PMD.EOL
- + "" + PMD.EOL + "testdesc" + PMD.EOL + "" + PMD.EOL + "";
+ private static final String REFERENCE_TO_RULESET_WITH_DEPRECATED_RULE = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n" +
+ "";
- private static final String DFA = "" + PMD.EOL + "" + PMD.EOL
- + "testdesc" + PMD.EOL + "" + "3" + PMD.EOL
- + "";
+ private static final String DFA = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "3\n"
+ + "";
- private static final String INCLUDE_EXCLUDE_RULESET = "" + PMD.EOL
- + "" + PMD.EOL + "testdesc" + PMD.EOL
- + "include1" + PMD.EOL + "include2"
- + PMD.EOL + "exclude1" + PMD.EOL
- + "exclude2" + PMD.EOL + "exclude3"
- + PMD.EOL + "";
+ private static final String INCLUDE_EXCLUDE_RULESET = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "include1\n"
+ + "include2\n"
+ + "\n"
+ + "exclude1\n"
+ + "exclude2\n"
+ + "exclude3\n"
+ + "\n"
+ + "";
- private static final String EXTERNAL_REFERENCE_RULE_SET = "" + PMD.EOL
- + "" + PMD.EOL + "testdesc" + PMD.EOL
- + "" + PMD.EOL + "";
+ private static final String EXTERNAL_REFERENCE_RULE_SET = "\n"
+ + "\n"
+ + "testdesc\n"
+ + "\n"
+ + "";
private Rule loadFirstRule(String ruleSetXml) throws RuleSetNotFoundException {
RuleSet rs = loadRuleSet(ruleSetXml);