ResultSet implements Iterable<Result> { public CompletableFuture<Map<String,Object>> statusAttributes() { final CompletableFuture<Map<String,Object>> attrs = new CompletableFuture<>(); readCompleted.thenRun(() -> attrs.complete(null == resultQueue.getStatusAttributes() ? Collections.emptyMap() : resultQueue.getStatusAttributes())); return attrs; } ResultSet(final ResultQueue resultQueue, final ExecutorService executor,
                     final CompletableFuture<Void> readCompleted, final RequestMessage originalRequestMessage,
                     final Host host); RequestMessage getOriginalRequestMessage(); Host getHost(); CompletableFuture<Map<String,Object>> statusAttributes(); boolean allItemsAvailable(); CompletableFuture<Void> allItemsAvailableAsync(); int getAvailableItemCount(); Result one(); CompletableFuture<List<Result>> some(final int items); CompletableFuture<List<Result>> all(); Stream<Result> stream(); @Override Iterator<Result> iterator();  }
@Test public void shouldReturnEmptyMapForNoResponseAttributes() throws Exception { final CompletableFuture<Map<String,Object>> attrs = resultSet.statusAttributes(); readCompleted.complete(null); assertThat(attrs.get().isEmpty(), is(true)); }