### Question:
DicomWebClient implements IDicomWebClient { public InputStream wadoRs(String path) throws IDicomWebClient.DicomWebException { try { HttpRequest httpRequest = requestFactory.buildGetRequest(new GenericUrl(serviceUrlPrefix + "/" + StringUtil.trim(path))); httpRequest.getHeaders().put("Accept", "application/dicom; transfer-syntax=*"); HttpResponse httpResponse = httpRequest.execute(); return httpResponse.getContent(); } catch (HttpResponseException e) { throw new DicomWebException( String.format("WadoRs: %d, %s", e.getStatusCode(), e.getStatusMessage()), e, e.getStatusCode(), Status.ProcessingFailure); } catch (IOException | IllegalArgumentException e) { throw new IDicomWebClient.DicomWebException(e); } } @Inject  DicomWebClient(
      HttpRequestFactory requestFactory,
      @Annotations.DicomwebAddr String serviceUrlPrefix,
      String stowPath); InputStream wadoRs(String path); JSONArray qidoRs(String path); void stowRs(InputStream in);  }### Answer:
@Test public void testDicomWebClient_Wado() throws Exception { byte[] dicomInstance = TestUtils.readTestFile(TestUtils.TEST_MR_FILE); fakeDicomWebServer.addWadoResponse(dicomInstance); InputStream responseStream = client.wadoRs("instanceName"); assertNotNull(responseStream); byte[] actual = ByteStreams.toByteArray(responseStream); if (!Arrays.equals(dicomInstance, actual)) { fail("wadoRs returned unexpected DICOM bytes"); } }
@Test public void testDicomWebClient_WadoError() throws Exception { fakeDicomWebServer.addResponseWithStatusCode(404); assertThrows(IDicomWebClient.DicomWebException.class, () -> client.wadoRs("instanceName")); }