Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Commit 6a8d3eb

Browse files
fix tests
1 parent 41e9e9d commit 6a8d3eb

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

gax-grpc/src/test/java/com/google/api/gax/grpc/ChannelPoolTest.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ public void channelPrimerIsCalledPeriodically() throws IOException {
201201

202202
Mockito.doAnswer(extractChannelRefresher)
203203
.when(scheduledExecutorService)
204-
.schedule(
205-
Mockito.any(Runnable.class), Mockito.anyLong(), Mockito.eq(TimeUnit.MILLISECONDS));
204+
.scheduleAtFixedRate(
205+
Mockito.any(Runnable.class), Mockito.anyLong(), Mockito.anyLong(), Mockito.any());
206206

207207
FakeChannelFactory channelFactory =
208208
new FakeChannelFactory(Arrays.asList(channel1, channel2, channel3), mockChannelPrimer);
@@ -211,26 +211,16 @@ public void channelPrimerIsCalledPeriodically() throws IOException {
211211
// 1 call during the creation
212212
Mockito.verify(mockChannelPrimer, Mockito.times(1))
213213
.primeChannel(Mockito.any(ManagedChannel.class));
214-
Mockito.verify(scheduledExecutorService, Mockito.times(1))
215-
.schedule(
216-
Mockito.any(Runnable.class), Mockito.anyLong(), Mockito.eq(TimeUnit.MILLISECONDS));
217214

218215
channelRefreshers.get(0).run();
219216
// 1 more call during channel refresh
220217
Mockito.verify(mockChannelPrimer, Mockito.times(2))
221218
.primeChannel(Mockito.any(ManagedChannel.class));
222-
Mockito.verify(scheduledExecutorService, Mockito.times(2))
223-
.schedule(
224-
Mockito.any(Runnable.class), Mockito.anyLong(), Mockito.eq(TimeUnit.MILLISECONDS));
225219

226220
channelRefreshers.get(0).run();
227221
// 1 more call during channel refresh
228222
Mockito.verify(mockChannelPrimer, Mockito.times(3))
229223
.primeChannel(Mockito.any(ManagedChannel.class));
230-
Mockito.verify(scheduledExecutorService, Mockito.times(3))
231-
.schedule(
232-
Mockito.any(Runnable.class), Mockito.anyLong(), Mockito.eq(TimeUnit.MILLISECONDS));
233-
scheduledExecutorService.shutdown();
234224
}
235225

236226
// ----

gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import static com.google.common.base.Preconditions.checkArgument;
3333
import static com.google.common.truth.Truth.assertThat;
3434
import static org.junit.Assert.assertEquals;
35-
import static org.junit.Assert.fail;
3635

3736
import com.google.api.core.ApiFunction;
3837
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.Builder;

0 commit comments

Comments
 (0)