### Question:
DefaultLightblueDiagnosticsResponse extends AbstractLightblueResponse implements LightblueDiagnosticsResponse { @Override public DiagnosticsElement getDiagnostics(String diagnosticsElementName) { if (!hasDiagnostics(diagnosticsElementName)) { throw new NoSuchElementException(diagnosticsElementName); } JsonNode node = getJson().get(diagnosticsElementName); Map<String, String> parameters = new LinkedHashMap<>(); Iterator<Entry<String, JsonNode>> iterator = node.fields(); while (iterator.hasNext()) { Map.Entry<String, JsonNode> entry = (Map.Entry<String, JsonNode>) iterator.next(); parameters.put(entry.getKey(), entry.getValue().asText()); } return new DiagnosticsElement(diagnosticsElementName, parameters); } DefaultLightblueDiagnosticsResponse(String responseText, Map<String, List<String>> headers);  DefaultLightblueDiagnosticsResponse(String responseText, Map<String, List<String>> headers,
            ObjectMapper mapper); @Override DiagnosticsElement getDiagnostics(String diagnosticsElementName); @Override boolean hasDiagnostics(String diagnosticsElementName); @Override List<DiagnosticsElement> getDiagnostics(); @Override boolean allHealthy();  }### Answer:
@Test public void testDiagnostics() throws Exception { URI uri = this.getClass().getClassLoader().getResource("diagnostics/lightblue-healthy-response.json").toURI(); String diagnosticsSuccessResponse = new String(Files.readAllBytes(Paths.get(uri)), Charset.forName("utf-8")); DefaultLightblueDiagnosticsResponse testResponse = new DefaultLightblueDiagnosticsResponse(diagnosticsSuccessResponse, null); DiagnosticsElement element = testResponse.getDiagnostics("MongoCRUDController"); Assert.assertEquals(true, element.isHealthy()); }
@Test(expected = NoSuchElementException.class) public void testDiagnostics_ElementNotPresent() throws Exception { URI uri = this.getClass().getClassLoader().getResource("diagnostics/lightblue-healthy-response.json").toURI(); String diagnosticsSuccessResponse = new String(Files.readAllBytes(Paths.get(uri)), Charset.forName("utf-8")); DefaultLightblueDiagnosticsResponse testResponse = new DefaultLightblueDiagnosticsResponse(diagnosticsSuccessResponse, null); testResponse.getDiagnostics("LdapCRUDController"); }
@Test public void testAllDiagnostics() throws Exception { URI uri = this.getClass().getClassLoader().getResource("diagnostics/lightblue-healthy-response.json").toURI(); String diagnosticsSuccessResponse = new String(Files.readAllBytes(Paths.get(uri)), Charset.forName("utf-8")); DefaultLightblueDiagnosticsResponse testResponse = new DefaultLightblueDiagnosticsResponse(diagnosticsSuccessResponse, null); Assert.assertEquals(2, testResponse.getDiagnostics().size()); }