@Test public void testAll() throws Exception { HttpClient client = new HttpClient("http: HttpResponse res = client.get(); Assert.assertEquals(HttpResponseStatus.OK, res.status()); Assert.assertTrue(res.content().toString(CharsetUtil.UTF_8).startsWith("[")); Assert.assertTrue(res.content().toString(CharsetUtil.UTF_8).endsWith("]")); }
private String all() { try { return new ObjectMapper().writeValueAsString( Topic.NEXUS.keySet().stream().map(key -> Topic.NEXUS.get(key)).collect(Collectors.toList())); } catch (JsonProcessingException e) { logger.error(e.getMessage(), e); this.httpResponse().setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR); return null; } }
Topics extends HttpRequestHandler { private String all() { try { return new ObjectMapper().writeValueAsString( Topic.NEXUS.keySet().stream().map(key -> Topic.NEXUS.get(key)).collect(Collectors.toList())); } catch (JsonProcessingException e) { logger.error(e.getMessage(), e); this.httpResponse().setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR); return null; } } }
Topics extends HttpRequestHandler { private String all() { try { return new ObjectMapper().writeValueAsString( Topic.NEXUS.keySet().stream().map(key -> Topic.NEXUS.get(key)).collect(Collectors.toList())); } catch (JsonProcessingException e) { logger.error(e.getMessage(), e); this.httpResponse().setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR); return null; } }  }
Topics extends HttpRequestHandler { private String all() { try { return new ObjectMapper().writeValueAsString( Topic.NEXUS.keySet().stream().map(key -> Topic.NEXUS.get(key)).collect(Collectors.toList())); } catch (JsonProcessingException e) { logger.error(e.getMessage(), e); this.httpResponse().setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR); return null; } }  @Override String service(); }
Topics extends HttpRequestHandler { private String all() { try { return new ObjectMapper().writeValueAsString( Topic.NEXUS.keySet().stream().map(key -> Topic.NEXUS.get(key)).collect(Collectors.toList())); } catch (JsonProcessingException e) { logger.error(e.getMessage(), e); this.httpResponse().setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR); return null; } }  @Override String service();  }