Source:
<code>public void testDefaultConversion() throws Exception { TimeZone defaultTimeZone = TimeZone.getDefault(); <START> TimeZone.setDefault(UTC_TIME_ZONE); <END> BeanWrapperFieldSetMapper<TestObject> mapper = new BeanWrapperFieldSetMapper<TestObject>(); mapper.setTargetType(TestObject.class); final String sampleString = "myString"; Date date = new Date(); BigDecimal bigDecimal = new BigDecimal(12345L); String dateString = date.toString(); FieldSet fieldSet = new DefaultFieldSet(new String[] { "12", "12345", "true", "Z", "123", "12345", "12345", "12", dateString, "12345", sampleString}, new String[] { "varInt", "varLong", "varBoolean", "varChar","varByte","varFloat", "varDouble", "varShort", "varDate", "varBigDecimal", "varString" }); mapper.setConversionService(new DefaultConversionService()); mapper.afterPropertiesSet(); TestObject bean = mapper.mapFieldSet(fieldSet); assertEquals("Expected 12 for varInt", bean.getVarInt(), 12); assertEquals("Expected 12345 for varLong", bean.getVarLong(), 12345L); assertEquals("Expected true for varBoolean", bean.isVarBoolean(), true); assertEquals("Expected Z for varChar", bean.getVarChar(), 'Z'); assertEquals("Expected A for varByte", bean.getVarByte(), 123); assertEquals("Expected 12345 for varFloat", bean.getVarFloat(), 12345F, 1F); assertEquals("Expected 12345 for varDouble", bean.getVarDouble(), 12345D, 1D); assertEquals("Expected 12 for varShort", bean.getVarShort(), 12); assertEquals("Expected currentDate for varDate", bean.getVarDate().toString(), dateString); assertEquals("Expected 12345 for varBigDecimal", bean.getVarBigDecimal(), bigDecimal); assertEquals("Expected " + sampleString + " for varString", bean.getVarString(), sampleString); TimeZone.setDefault(defaultTimeZone); }</code><technical_language>This done in a @Before reset in @After</technical_language>

Target:
public void testDefaultConversion() throws Exception { BeanWrapperFieldSetMapper<TestObject> mapper = new BeanWrapperFieldSetMapper<TestObject>(); mapper.setTargetType(TestObject.class); final String sampleString = "myString"; Date date = new Date(); BigDecimal bigDecimal = new BigDecimal(12345L); String dateString = date.toString(); FieldSet fieldSet = new DefaultFieldSet(new String[] { "12", "12345", "true", "Z", "123", "12345", "12345", "12", dateString, "12345", sampleString}, new String[] { "varInt", "varLong", "varBoolean", "varChar","varByte","varFloat", "varDouble", "varShort", "varDate", "varBigDecimal", "varString" }); mapper.setConversionService(new DefaultConversionService()); mapper.afterPropertiesSet(); TestObject bean = mapper.mapFieldSet(fieldSet); assertEquals("Expected 12 for varInt", bean.getVarInt(), 12); assertEquals("Expected 12345 for varLong", bean.getVarLong(), 12345L); assertEquals("Expected true for varBoolean", bean.isVarBoolean(), true); assertEquals("Expected Z for varChar", bean.getVarChar(), 'Z'); assertEquals("Expected A for varByte", bean.getVarByte(), 123); assertEquals("Expected 12345 for varFloat", bean.getVarFloat(), 12345F, 1F); assertEquals("Expected 12345 for varDouble", bean.getVarDouble(), 12345D, 1D); assertEquals("Expected 12 for varShort", bean.getVarShort(), 12); assertEquals("Expected currentDate for varDate", bean.getVarDate().toString(), dateString); assertEquals("Expected 12345 for varBigDecimal", bean.getVarBigDecimal(), bigDecimal); assertEquals("Expected " + sampleString + " for varString", bean.getVarString(), sampleString); }