### Question:
JsonFormatter implements Formatter { @Override public String format(Object object) { try { return objectMapper.writeValueAsString(object); } catch (JsonProcessingException e) { throw new IllegalArgumentException(e); } } JsonFormatter();  JsonFormatter(ObjectMapper objectMapper); @Override String format(Object object);  }### Answer:
@Test public void testFormat() { JsonFormatter formatter = new JsonFormatter(); Assert.assertEquals("{\"id\":1,\"name\":\"小马哥\"}", formatter.format(new User())); }