mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-21 13:25:30 +00:00
RESOLVED - issue SPR-6195
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2194 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
+23
@@ -37,6 +37,29 @@ public class StringArrayPropertyEditorTests extends TestCase {
|
||||
assertEquals("0,1,2", editor.getAsText());
|
||||
}
|
||||
|
||||
public void testTrimByDefault() throws Exception {
|
||||
StringArrayPropertyEditor editor = new StringArrayPropertyEditor();
|
||||
editor.setAsText(" 0,1 , 2 ");
|
||||
Object value = editor.getValue();
|
||||
String[] array = (String[]) value;
|
||||
for (int i = 0; i < array.length; ++i) {
|
||||
assertEquals("" + i, array[i]);
|
||||
}
|
||||
assertEquals("0,1,2", editor.getAsText());
|
||||
}
|
||||
|
||||
public void testNoTrim() throws Exception {
|
||||
StringArrayPropertyEditor editor = new StringArrayPropertyEditor(",",false,false);
|
||||
editor.setAsText(" 0,1 , 2 ");
|
||||
Object value = editor.getValue();
|
||||
String[] array = (String[]) value;
|
||||
for (int i = 0; i < array.length; ++i) {
|
||||
assertEquals(3, array[i].length());
|
||||
assertEquals("" + i, array[i].trim());
|
||||
}
|
||||
assertEquals(" 0,1 , 2 ", editor.getAsText());
|
||||
}
|
||||
|
||||
public void testWithCustomSeparator() throws Exception {
|
||||
StringArrayPropertyEditor editor = new StringArrayPropertyEditor(":");
|
||||
editor.setAsText("0:1:2");
|
||||
|
||||
Reference in New Issue
Block a user