Skip to content

Commit

Permalink
add additional mock
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeWang1127 committed Dec 6, 2024
1 parent 9306d61 commit e22b374
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.when;

import com.google.api.gax.core.CredentialsProvider;
Expand Down Expand Up @@ -53,10 +54,14 @@ class LanguageAutoConfigurationTests {
private static final String TRANSPORT_CHANNEL_PROVIDER_QUALIFIER_NAME =
"defaultLanguageServiceTransportChannelProvider";

@Mock private TransportChannel mockTransportChannel;
@Mock private ApiCallContext mockApiCallContext;
@Mock private TransportChannelProvider mockTransportChannelProvider;
@Mock private CredentialsProvider mockCredentialsProvider;
@Mock
private TransportChannel mockTransportChannel;
@Mock
private ApiCallContext mockApiCallContext;
@Mock
private TransportChannelProvider mockTransportChannelProvider;
@Mock
private CredentialsProvider mockCredentialsProvider;

private ApplicationContextRunner contextRunner =
new ApplicationContextRunner()
Expand Down Expand Up @@ -192,6 +197,8 @@ void testExecutorThreadCountFromProperties() {
void testCustomTransportChannelProviderUsedWhenProvided() throws IOException {
when(mockTransportChannelProvider.getTransportName()).thenReturn("grpc");
when(mockTransportChannelProvider.getTransportChannel()).thenReturn(mockTransportChannel);
when(mockTransportChannelProvider.withUseS2A(anyBoolean()))
.thenReturn(mockTransportChannelProvider);
when(mockTransportChannel.getEmptyCallContext()).thenReturn(mockApiCallContext);
when(mockApiCallContext.withCredentials(any())).thenReturn(mockApiCallContext);
when(mockApiCallContext.withTransportChannel(any())).thenReturn(mockApiCallContext);
Expand Down

0 comments on commit e22b374

Please sign in to comment.