You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2026/07/23 18:42:01 UTC
(commons-beanutils) branch master updated: Add ArrayConverterTest.testForwardSlashSeparator() from PR #427
This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git
The following commit(s) were added to refs/heads/master by this push:
new 3d7c3309 Add ArrayConverterTest.testForwardSlashSeparator() from PR #427
3d7c3309 is described below
commit 3d7c33094c096f876f71796f509507676c39b9f6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jul 23 14:41:56 2026 -0400
Add ArrayConverterTest.testForwardSlashSeparator() from PR #427
---
.../beanutils2/converters/ArrayConverterTest.java | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/test/java/org/apache/commons/beanutils2/converters/ArrayConverterTest.java b/src/test/java/org/apache/commons/beanutils2/converters/ArrayConverterTest.java
index bbb2da0c..6f7be51f 100644
--- a/src/test/java/org/apache/commons/beanutils2/converters/ArrayConverterTest.java
+++ b/src/test/java/org/apache/commons/beanutils2/converters/ArrayConverterTest.java
@@ -163,6 +163,27 @@ class ArrayConverterTest {
assertThrows(NullPointerException.class, () -> new ArrayConverter(int[].class, null));
}
+ void testForwardSlashSeparator() {
+ final String value = "first/value,second/value";
+ final ArrayConverter<String[]> converter = new ArrayConverter<>(String[].class, new StringConverter());
+ // test forward slash not allowed (the default)
+ String[] result = converter.convert(String[].class, value);
+ assertNotNull(result, "result.null");
+ assertEquals(4, result.length, "result.length");
+ assertEquals("first", result[0], "result[0]");
+ assertEquals("value", result[1], "result[1]");
+ assertEquals("second", result[2], "result[2]");
+ assertEquals("value", result[3], "result[3]");
+ // configure the converter to allow forward slash
+ converter.setAllowedChars(new char[] { '.', '-', '/' });
+ // test forward slash allowed
+ result = converter.convert(String[].class, value);
+ assertNotNull(result, "result.null");
+ assertEquals(2, result.length, "result.length");
+ assertEquals("first/value", result[0], "result[0]");
+ assertEquals("second/value", result[1], "result[1]");
+ }
+
/**
* Test Converting using the IntegerConverter as the component Converter.
*/