diff --git a/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java b/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java index 390dc60d5..b503e28da 100644 --- a/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java +++ b/gax/src/test/java/com/google/api/gax/batching/BatcherImplTest.java @@ -887,10 +887,15 @@ public void run() { } try { - future.get(100, TimeUnit.MILLISECONDS); + future.get(3, TimeUnit.SECONDS); } catch (TimeoutException e) { assertWithMessage("adding elements to batcher should not be blocked").fail(); } + + // Mockito recommends using verify() as the ONLY way to interact with Argument + // captors - otherwise it may incur in unexpected behaviour + Mockito.verify(callContext).withOption(key.capture(), value.capture()); + // Verify that throttled time is recorded in ApiCallContext assertThat(key.getValue()).isSameInstanceAs(Batcher.THROTTLED_TIME_KEY); assertThat(value.getValue()).isAtLeast(throttledTime);