assertSame(jodder.getWork(), target.get("work"));
}
@Test
public void testConvertPersonToMap2() {
Person jodder = new DataCreator().createJodder();
final Map<String, Object> target = new HashMap<String, Object>();
JsonContext jsonContext = new JsonSerializer()
.include("phones")
.excludeTypes(Address.class)
.createJsonContext(null);
BeanSerializer beanSerializer = new BeanSerializer(jsonContext, jodder) {
@Override
protected void onSerializableProperty(String propertyName, Class propertyType, Object value) {
target.put(propertyName, value);
}
};
beanSerializer.serialize();
assertEquals(5, target.size());
assertSame(jodder.getBirthdate(), target.get("birthdate"));
assertSame(jodder.getFirstBaseBallGame(), target.get("firstBaseBallGame"));
assertSame(jodder.getLastname(), target.get("lastname"));
assertSame(jodder.getFirstname(), target.get("firstname"));
assertSame(jodder.getPhones(), target.get("phones"));
}