From dfa9e646febfb84be94ee241c10a181d3ba97f0c Mon Sep 17 00:00:00 2001 From: dsyer Date: Wed, 19 Dec 2007 21:21:23 +0000 Subject: [PATCH] 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. --- .../mapping/BeanWrapperFieldSetMapperTests.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/support/mapping/BeanWrapperFieldSetMapperTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/support/mapping/BeanWrapperFieldSetMapperTests.java index c6073091b..64219bfe8 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/support/mapping/BeanWrapperFieldSetMapperTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/support/mapping/BeanWrapperFieldSetMapperTests.java @@ -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;