ZipkinHealthController { static String writeJsonError(String error) throws IOException { StringWriter writer = new StringWriter(); try (JsonGenerator generator = JsonUtil.createGenerator(writer)) { generator.writeStartObject(); generator.writeStringField("status", STATUS_DOWN); generator.writeObjectFieldStart("zipkin"); generator.writeStringField("status", STATUS_DOWN); generator.writeObjectFieldStart("details"); generator.writeStringField("error", error); generator.writeEndObject(); generator.writeEndObject(); generator.writeEndObject(); } return writer.toString(); } ZipkinHealthController(List<Component> components); @Get("/actuator/health") CompletableFuture<HttpResponse> getActuatorHealth(ServiceRequestContext ctx); @Get("/health") CompletableFuture<HttpResponse> getHealth(ServiceRequestContext ctx);  }
@Test public void writeJsonError_writesNestedError() throws Exception { assertThat(ZipkinHealthController.writeJsonError("robots")).isEqualTo("" + "{\n" + " \"status\" : \"DOWN\",\n" + " \"zipkin\" : {\n" + " \"status\" : \"DOWN\",\n" + " \"details\" : {\n" + " \"error\" : \"robots\"\n" + " }\n" + " }\n" + "}" ); }