public class CustomConverterMappingTest extends AbstractFunctionalTest {
@Test
public void testSimpleCustomConverter() throws Exception {
mapper = getMapper(new String[] { "simpleCustomConverter.xml" });
SimpleObj src = newInstance(SimpleObj.class);
src.setField1(String.valueOf(System.currentTimeMillis()));
SimpleObjPrime2 dest = mapper.map(src, SimpleObjPrime2.class);
// Custom converter specified for the field1 mapping, so verify custom converter was actually used
assertNotNull("dest field1 should not be null", dest.getField1Prime());
StringTokenizer st = new StringTokenizer(dest.getField1Prime(), "-");
assertEquals("dest field1 value should contain a hyphon", 2, st.countTokens());
String token1 = st.nextToken();
assertEquals("1st portion of dest field1 value should equal src field value", src.getField1(), token1);
String token2 = st.nextToken();
assertEquals("dest field1 value should have been appended to by the cust converter",
StringAppendCustomConverter.APPENDED_VALUE, token2);
}