RESOLVED - issue SPR-6195
This commit is contained in:
@@ -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