RESOLVED - issue BATCH-154: Re-implement BeanWrapperFieldSetMapper using a DataBinder

http://opensource.atlassian.com/projects/spring/browse/BATCH-154

Check that binder still works with default property editors.
This commit is contained in:
dsyer
2007-12-19 21:21:23 +00:00
parent d0c42b7be1
commit dfa9e646fe

View File

@@ -351,6 +351,21 @@ public class BeanWrapperFieldSetMapperTests extends TestCase {
assertEquals(9, bean.getVarLong());
}
public void testPaddedLongWithDefaultAndCustomEditor() throws Exception {
BeanWrapperFieldSetMapper mapper = new BeanWrapperFieldSetMapper();
mapper.setTargetType(TestObject.class);
FieldSet fieldSet = new FieldSet(new String[] { "00009", "78" }, new String[] { "varLong", "varInt" });
mapper.setCustomEditors(Collections.singletonMap(Long.TYPE, new CustomNumberEditor(Long.class, NumberFormat
.getNumberInstance(), true)));
TestObject bean = (TestObject) mapper.mapLine(fieldSet);
assertEquals(9, bean.getVarLong());
assertEquals(78, bean.getVarInt());
}
private static class BeanWithIntArray {
private int[] numbers;