JacksonDSL { public static Representation JacksonJson(final Object object, final ObjectMapper jackson) { return new Representation() { @Override public void write(OutputStream out) { try { jackson.writeValue(out, object); } catch (Exception e) { throw new RuntimeException(e); } } @Override public String contentType() { return DSL.CONTENT_TYPE_JSON; } }; }  static RepresentationConverter convertRepresentation(Representation representation); static Representation JacksonJson(final Object object, final ObjectMapper jackson); static Representation JsonStream(final Iterable<String> stream); static Representation JacksonJson(final Object object);  }
@Test public void writesJsonRepresentationsOfSimpleBeans() { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); RandomBean input = new RandomBean("Hello"); JacksonDSL.JacksonJson(input).write(outputStream); assertEquals(outputStream.toString(), "{\"message\":\"Hello\"}"); }