diff --git a/pmd-core/src/test/java/net/sourceforge/pmd/RuleSetWriterTest.java b/pmd-core/src/test/java/net/sourceforge/pmd/RuleSetWriterTest.java
index 27c68f645d..3d88a33c27 100644
--- a/pmd-core/src/test/java/net/sourceforge/pmd/RuleSetWriterTest.java
+++ b/pmd-core/src/test/java/net/sourceforge/pmd/RuleSetWriterTest.java
@@ -4,6 +4,10 @@
package net.sourceforge.pmd;
+import static net.sourceforge.pmd.util.CollectionUtil.listOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayOutputStream;
@@ -87,4 +91,19 @@ class RuleSetWriterTest {
String written = out.toString("UTF-8");
assertTrue(written.contains("ref=\"rulesets/dummy/basic.xml/DummyBasicMockRule\""));
}
+
+ @Test
+ void testXmlPropertyWithDelimiter() throws Exception {
+ RuleSet rs = new RuleSetLoader().loadFromResource("net/sourceforge/pmd/TestRulesetProperties.xml");
+
+ Rule rule = rs.getRuleByName("MockRule4");
+ assertEquals(listOf("bar", "foo"), rule.getProperty(rule.getPropertyDescriptor("stringList")));
+ assertEquals(listOf("bar", "foo"), rule.getProperty(rule.getPropertyDescriptor("stringListWithDelim")));
+
+ writer.write(rs);
+
+ String written = out.toString("UTF-8");
+ assertThat(written, containsString("delimiter="));
+ }
+
}
diff --git a/pmd-core/src/test/resources/net/sourceforge/pmd/TestRulesetProperties.xml b/pmd-core/src/test/resources/net/sourceforge/pmd/TestRulesetProperties.xml
new file mode 100644
index 0000000000..7301b6185f
--- /dev/null
+++ b/pmd-core/src/test/resources/net/sourceforge/pmd/TestRulesetProperties.xml
@@ -0,0 +1,29 @@
+
+
+
+
+ Ruleset used by test net.sourceforge.pmd.RuleSetWriter and RuleSetFactoryTest
+
+
+
+
+ Just for test
+
+ 3
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/RuleSetFactoryTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/RuleSetFactoryTest.java
index 4efb26bb28..d6cafa265a 100644
--- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/RuleSetFactoryTest.java
+++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/RuleSetFactoryTest.java
@@ -4,31 +4,11 @@
package net.sourceforge.pmd.lang.java;
-import static org.junit.jupiter.api.Assertions.assertNull;
-
-import org.junit.jupiter.api.Test;
-
import net.sourceforge.pmd.AbstractRuleSetFactoryTest;
-import net.sourceforge.pmd.Rule;
-import net.sourceforge.pmd.RuleSet;
-import net.sourceforge.pmd.RuleSetLoader;
/**
* Test java's rulesets
*/
class RuleSetFactoryTest extends AbstractRuleSetFactoryTest {
- @Test
- void testExclusionOfUselessParantheses() {
- RuleSet ruleset = new RuleSetLoader().loadFromString("",
- "\n" + "\n"
- + " Custom ruleset for tests\n"
- + " \n"
- + " \n" + " \n" + "\n");
- Rule rule = ruleset.getRuleByName("UselessParentheses");
- assertNull(rule);
- }
}
diff --git a/pmd-test/src/main/java/net/sourceforge/pmd/AbstractRuleSetFactoryTest.java b/pmd-test/src/main/java/net/sourceforge/pmd/AbstractRuleSetFactoryTest.java
index 06c79b7aee..5cebc2accd 100644
--- a/pmd-test/src/main/java/net/sourceforge/pmd/AbstractRuleSetFactoryTest.java
+++ b/pmd-test/src/main/java/net/sourceforge/pmd/AbstractRuleSetFactoryTest.java
@@ -503,7 +503,8 @@ public abstract class AbstractRuleSetFactoryTest {
value1 = ((Pattern) value1).pattern();
value2 = ((Pattern) value2).pattern();
}
- assertEquals(value1, value2, message + ", Rule property value " + j);
+ assertEquals(value1, value2, message + ", Rule " + rule1.getName() + " property "
+ + propertyDescriptors1.get(j).name());
}
assertEquals(propertyDescriptors1.size(), propertyDescriptors2.size(),
message + ", Rule property descriptor count");