@Test public void valid() throws IOException { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final ResponseWriter writer = new ResponseWriter(out); final EclipseParser parser = new EclipseParser(); Response response; final String source = IOUtils.toString( getClass().getResourceAsStream("/helloWorld.java"), StandardCharsets.UTF_8); response = new Response(); response.status = "ok"; response.ast = parser.parse(source); writer.write(response); }
public void write(final Response response) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); mapper.writeValue(out, response); out.write('\n'); this.out.write(out.toByteArray()); }
ResponseWriter { public void write(final Response response) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); mapper.writeValue(out, response); out.write('\n'); this.out.write(out.toByteArray()); } }
ResponseWriter { public void write(final Response response) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); mapper.writeValue(out, response); out.write('\n'); this.out.write(out.toByteArray()); } ResponseWriter(final OutputStream out); }
ResponseWriter { public void write(final Response response) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); mapper.writeValue(out, response); out.write('\n'); this.out.write(out.toByteArray()); } ResponseWriter(final OutputStream out); void setContent(String content); void write(final Response response); }
ResponseWriter { public void write(final Response response) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); mapper.writeValue(out, response); out.write('\n'); this.out.write(out.toByteArray()); } ResponseWriter(final OutputStream out); void setContent(String content); void write(final Response response);  }