private void doTestGetAll(boolean sync, boolean error, boolean partial) throws Exception {
TableReadFunction<String, String> readFn = mock(TableReadFunction.class);
Map<String, String> res = new HashMap<>();
res.put("foo1", "bar1");
if (!partial) {
res.put("foo2", "bar2");
}
CompletableFuture<Map<String, String>> future;
if (error) {
future = new CompletableFuture();
future.completeExceptionally(new RuntimeException("Test exception"));
} else {
future = CompletableFuture.completedFuture(res);
}
doReturn(future).when(readFn).getAllAsync(any());
RemoteTable<String, String> table = getTable("testGetAll-" + sync + error + partial, readFn, null, false);
Assert.assertEquals(res, sync ? table.getAll(Arrays.asList("foo1", "foo2"))
: table.getAllAsync(Arrays.asList("foo1", "foo2")).get());
verify(table.readRateLimiter, times(1)).throttle(anyCollection());
}