### Question:
LightblueHttpClient implements LightblueClient, Closeable { @Override public ResultStream prepareFind(DataFindRequest req) throws LightblueException { return new ResultStream(new StreamingClosure(req),mapper); } 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 testStreaming() throws Exception { when(httpTransport.executeRequestGetStream(any(LightblueRequest.class),anyString())). thenReturn(new StringBufferInputStream(streamingResponse.replaceAll("'","\""))); LightblueClientConfiguration c = new LightblueClientConfiguration(); try (LightblueHttpClient httpClient = new LightblueHttpClient(c, httpTransport)) { DataFindRequest findRequest = new DataFindRequest("test"); findRequest.where(Query.withValue("a = b")); findRequest.select(Projection.includeField("foo")); ResultStream response=httpClient.prepareFind(findRequest); final List<JsonNode> docs=new ArrayList<JsonNode>(); response.run(new ResultStream.ForEachDoc() { @Override public boolean processDocument(ResultStream.StreamDoc doc) { docs.add(doc.doc); return true; } }); Assert.assertEquals(9,docs.size()); } }
@Test public void testNotStreaming() throws Exception { when(httpTransport.executeRequestGetStream(any(LightblueRequest.class),anyString())). thenReturn(new StringBufferInputStream(nonStreamingResponse.replaceAll("'","\""))); LightblueClientConfiguration c = new LightblueClientConfiguration(); try (LightblueHttpClient httpClient = new LightblueHttpClient(c, httpTransport)) { DataFindRequest findRequest = new DataFindRequest("test"); findRequest.where(Query.withValue("a = b")); findRequest.select(Projection.includeField("foo")); ResultStream response=httpClient.prepareFind(findRequest); final List<JsonNode> docs=new ArrayList<JsonNode>(); response.run(new ResultStream.ForEachDoc() { @Override public boolean processDocument(ResultStream.StreamDoc doc) { docs.add(doc.doc); return true; } }); Assert.assertEquals(9,docs.size()); } }