### Question:
LightblueHttpClient implements LightblueClient, Closeable { @Override public LightblueDiagnosticsResponse diagnostics() throws LightblueParseException, LightblueResponseException, LightblueException { HttpResponse response = callService(new LightblueDiagnosticsRequest(), configuration.getDataServiceURI()); try { return new DefaultLightblueDiagnosticsResponse(response.getBody(), response.getHeaders(), mapper); } catch (LightblueParseException e) { throw new LightblueParseException("Unable to parse response " + response, e); } } LightblueHttpClient();  LightblueHttpClient(String configFilePath);  LightblueHttpClient(LightblueClientConfiguration configuration);  LightblueHttpClient(LightblueClientConfiguration configuration, ObjectMapper mapper);  LightblueHttpClient(LightblueClientConfiguration configuration, HttpTransport httpTransport);  LightblueHttpClient(LightblueClientConfiguration configuration, HttpTransport httpTransport, ObjectMapper mapper); @Override Locking getLocking(String domain); @Override DefaultLightblueMetadataResponse metadata(LightblueMetadataRequest lightblueRequest); @Override DefaultLightblueDataResponse data(LightblueDataRequest lightblueRequest); @Override T data(LightblueDataRequest lightblueRequest, Class<T> type); @Override DefaultLightblueBulkDataResponse bulkData(DataBulkRequest lightblueRequests); @Override void close(); @Override ResultStream prepareFind(DataFindRequest req); static void main(String[] args); @Override LightblueDiagnosticsResponse diagnostics();  }### Answer:
@Test public void testLightblueDiagnosticsElementPresent() throws Exception { Map<String, String> parameters = new LinkedHashMap<>(3); parameters.put("healthy", "true"); parameters.put("database", "data"); DiagnosticsElement expectedElementDiagnostics = new DiagnosticsElement("MongoCRUDController", parameters); URI uri = this.getClass().getClassLoader().getResource("diagnostics/lightblue-healthy-response.json").toURI(); String diagnosticsResponse = new String(Files.readAllBytes(Paths.get(uri)), Charset.forName("utf-8")); when(httpTransport.executeRequest(any(LightblueDiagnosticsRequest.class), anyString())).thenReturn(new FakeResponse(diagnosticsResponse, null)); LightblueClientConfiguration c = new LightblueClientConfiguration(); try (LightblueHttpClient httpClient = new LightblueHttpClient(c, httpTransport)) { LightblueDiagnosticsResponse response = httpClient.diagnostics(); DiagnosticsElement elementDiagnostics = response.getDiagnostics("MongoCRUDController"); Assert.assertEquals(expectedElementDiagnostics, elementDiagnostics); Assert.assertTrue(elementDiagnostics.isHealthy()); Assert.assertEquals("MongoCRUDController", elementDiagnostics.getElementName()); } }
@Test (expected = NoSuchElementException.class) public void testLightblueDiagnosticsElementNotPresent() throws Exception { URI uri = this.getClass().getClassLoader().getResource("diagnostics/lightblue-healthy-response.json").toURI(); String diagnosticsResponse = new String(Files.readAllBytes(Paths.get(uri)), Charset.forName("utf-8")); when(httpTransport.executeRequest(any(LightblueDiagnosticsRequest.class), anyString())).thenReturn(new FakeResponse(diagnosticsResponse, null)); LightblueClientConfiguration c = new LightblueClientConfiguration(); try (LightblueHttpClient httpClient = new LightblueHttpClient(c, httpTransport)) { LightblueDiagnosticsResponse response = httpClient.diagnostics(); DiagnosticsElement elementDiagnostics = response.getDiagnostics("mongocrudcontroller"); Assert.assertEquals(null, elementDiagnostics); } }
@Test public void testLightblueDiagnosticsAllElements() throws Exception { URI uri = this.getClass().getClassLoader().getResource("diagnostics/lightblue-healthy-response.json").toURI(); String diagnosticsResponse = new String(Files.readAllBytes(Paths.get(uri)), Charset.forName("utf-8")); when(httpTransport.executeRequest(any(LightblueDiagnosticsRequest.class), anyString())).thenReturn(new FakeResponse(diagnosticsResponse, null)); LightblueClientConfiguration c = new LightblueClientConfiguration(); try (LightblueHttpClient httpClient = new LightblueHttpClient(c, httpTransport)) { LightblueDiagnosticsResponse response = httpClient.diagnostics(); List<DiagnosticsElement> elementDiagnostics = response.getDiagnostics(); Assert.assertEquals(2, elementDiagnostics.size()); } }