83. JettyServletTester.runServlet((req, resp) -> { resp.getWriter().print("Hey"); }, (uri) -> { try (CloseableHttpClient client = HttpClientBuilder.create() .build()) { HttpGet request = new HttpGet(uri); try (CloseableHttpResponse resp = client.execute(request)) { String body = EntityUtils.toString(resp.getEntity(), StandardCharsets.UTF_8); assertEquals("Hey", body); } } });
{{#tags}}- {{label}}
{{/tags}}