public void testTypeIdResolver() throws Exception
{
ObjectMapper mapper = new ObjectMapper();
mapper.setHandlerInstantiator(new MyInstantiator("foobar"));
String json = mapper.writeValueAsString(new TypeIdBeanWrapper(new TypeIdBean(123)));
// should now use our custom id scheme:
assertEquals("{\"bean\":[\"!!!\",{\"x\":123}]}", json);
// and bring it back too:
TypeIdBeanWrapper result = mapper.readValue(json, TypeIdBeanWrapper.class);
TypeIdBean bean = result.bean;