public void testScalarsWithTyping() throws Exception {
  ObjectMapper m=new ObjectMapper();
  String json;
  DynamicWrapper result;
  json=m.writeValueAsString(new DynamicWrapper(Integer.valueOf(3)));
  result=m.readValue(json,DynamicWrapper.class);
  assertEquals(Integer.valueOf(3),result.value);
  json=m.writeValueAsString(new DynamicWrapper("abc"));
  result=m.readValue(json,DynamicWrapper.class);
  assertEquals("abc",result.value);
  json=m.writeValueAsString(new DynamicWrapper("abc"));
  result=m.readValue(json,DynamicWrapper.class);
  assertEquals("abc",result.value);
  json=m.writeValueAsString(new DynamicWrapper(Boolean.TRUE));
  result=m.readValue(json,DynamicWrapper.class);
  assertEquals(Boolean.TRUE,result.value);
  json=m.writeValueAsString(new DynamicWrapper(Long.valueOf(7L)));
  result=m.readValue(json,DynamicWrapper.class);
  assertEquals(Long.valueOf(7),result.value);
  json=m.writeValueAsString(new DynamicWrapper(TestEnum.B));
  result=m.readValue(json,DynamicWrapper.class);
  assertEquals(TestEnum.B,result.value);
}

public void testScalarsWithTyping ( ) throws Exception { ObjectMapper m = new ObjectMapper ( ) ; String json ; DynamicWrapper result ; json = m . writeValueAsString ( new DynamicWrapper ( Integer . valueOf ( 3 ) ) ) ; result = m . readValue ( json , DynamicWrapper . class ) ; assertEquals ( Integer . valueOf ( 3 ) , result . value ) ; json = m . writeValueAsString ( new DynamicWrapper ( "abc" ) ) ; result = m . readValue ( json , DynamicWrapper . class ) ; assertEquals ( "abc" , result . value ) ; json = m . writeValueAsString ( new DynamicWrapper ( "abc" ) ) ; result = m . readValue ( json , DynamicWrapper . class ) ; assertEquals ( "abc" , result . value ) ; json = m . writeValueAsString ( new DynamicWrapper ( Boolean . TRUE ) ) ; result = m . readValue ( json , DynamicWrapper . class ) ; assertEquals ( Boolean . TRUE , result . value ) ; json = m . writeValueAsString ( new DynamicWrapper ( Long . valueOf ( 7L ) ) ) ; result = m . readValue ( json , DynamicWrapper . class ) ; assertEquals ( Long . valueOf ( 7 ) , result . value ) ; json = m . writeValueAsString ( new DynamicWrapper ( TestEnum . B ) ) ; result = m . readValue ( json , DynamicWrapper . class ) ; assertEquals ( TestEnum . B , result . value ) ; }
ensure that per - property dynamic types work , both for " native " types and others
