use of com.google.api.gax.rpc.testing.FakeBatchableApi.LabeledIntSquarerCallable in project gax-java by googleapis.
the class BatcherImplTest method testSendOutstanding.
@Test
public void testSendOutstanding() {
final AtomicInteger callableCounter = new AtomicInteger();
underTest = new BatcherImpl<>(SQUARER_BATCHING_DESC_V2, new LabeledIntSquarerCallable() {
@Override
public ApiFuture<List<Integer>> futureCall(LabeledIntList request, ApiCallContext context) {
callableCounter.incrementAndGet();
return super.futureCall(request, context);
}
}, labeledIntList, batchingSettings, EXECUTOR);
// Empty Batcher
underTest.sendOutstanding();
assertThat(callableCounter.get()).isEqualTo(0);
underTest.add(2);
underTest.add(3);
underTest.add(4);
underTest.sendOutstanding();
assertThat(callableCounter.get()).isEqualTo(1);
}
Aggregations