.addValueReader(valueReader);
}
public void shouldMapFromJsonElement() throws Exception {
String orderJson = "{\"id\":456, \"customer\":{\"id\":789, \"street_address\":\"123 Main Street\", \"address_city\":\"SF\"}}";
JsonParser jsonParser = new JsonParser();
JsonElement element = jsonParser.parse(orderJson);
Order order = modelMapper.map(element, Order.class);
assertEquals(order.id, 456);
assertEquals(order.customer.id, 789);
assertEquals(order.customer.address.street, "123 Main Street");
assertEquals(order.customer.address.city, "SF");
String flatOrderJson = "{\"id\":222, \"customer_id\":333, \"customer_street_address\":\"444 Main Street\", \"customer_address_city\":\"LA\"}";
element = jsonParser.parse(flatOrderJson);
order = modelMapper.map(element, Order.class, "flat");
assertEquals(order.id, 222);
assertEquals(order.customer.id, 333);