From 51ba0194e6725b96fe8dd43099c10b718a1b00c8 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Thu, 19 Dec 2024 16:06:14 -0500 Subject: [PATCH] fix unit test --- .../spring/pubsub/support/DefaultPublisherFactoryTests.java | 2 -- .../pubsub/support/DefaultSubscriberFactoryTests.java | 6 +++--- .../language/v2/spring/LanguageAutoConfigurationTests.java | 3 --- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/spring-cloud-gcp-pubsub/src/test/java/com/google/cloud/spring/pubsub/support/DefaultPublisherFactoryTests.java b/spring-cloud-gcp-pubsub/src/test/java/com/google/cloud/spring/pubsub/support/DefaultPublisherFactoryTests.java index 71b94953a1..1fc4e7df42 100644 --- a/spring-cloud-gcp-pubsub/src/test/java/com/google/cloud/spring/pubsub/support/DefaultPublisherFactoryTests.java +++ b/spring-cloud-gcp-pubsub/src/test/java/com/google/cloud/spring/pubsub/support/DefaultPublisherFactoryTests.java @@ -19,7 +19,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -47,7 +46,6 @@ public void setUp() throws IOException { factory.setCredentialsProvider(NoCredentialsProvider.create()); TransportChannelProvider mockChannelProvider = mock(TransportChannelProvider.class); TransportChannel mockTransportChannel = mock(TransportChannel.class); - when(mockChannelProvider.withUseS2A(anyBoolean())).thenReturn(mockChannelProvider); when(mockChannelProvider.getTransportChannel()).thenReturn(mockTransportChannel); ApiCallContext mockContext = mock(ApiCallContext.class); when(mockTransportChannel.getEmptyCallContext()).thenReturn(mockContext); diff --git a/spring-cloud-gcp-pubsub/src/test/java/com/google/cloud/spring/pubsub/support/DefaultSubscriberFactoryTests.java b/spring-cloud-gcp-pubsub/src/test/java/com/google/cloud/spring/pubsub/support/DefaultSubscriberFactoryTests.java index 67f3279c94..f3d41e2d74 100644 --- a/spring-cloud-gcp-pubsub/src/test/java/com/google/cloud/spring/pubsub/support/DefaultSubscriberFactoryTests.java +++ b/spring-cloud-gcp-pubsub/src/test/java/com/google/cloud/spring/pubsub/support/DefaultSubscriberFactoryTests.java @@ -384,9 +384,9 @@ void testCreateSubscriber_validateSetProperties() { assertThat(expectedSubscriber.getFlowControlSettings().getLimitExceededBehavior()) .isEqualTo(FlowController.LimitExceededBehavior.Ignore); assertThat(expectedSubscriber) - .hasFieldOrPropertyWithValue("maxAckExtensionPeriod", Duration.ofSeconds(2L)) - .hasFieldOrPropertyWithValue("minDurationPerAckExtension", Duration.ofSeconds(3L)) - .hasFieldOrPropertyWithValue("maxDurationPerAckExtension", Duration.ofSeconds(4L)) + .hasFieldOrPropertyWithValue("maxAckExtensionPeriod", java.time.Duration.ofSeconds(2L)) + .hasFieldOrPropertyWithValue("minDurationPerAckExtension", java.time.Duration.ofSeconds(3L)) + .hasFieldOrPropertyWithValue("maxDurationPerAckExtension", java.time.Duration.ofSeconds(4L)) .hasFieldOrPropertyWithValue("numPullers", 2) .hasFieldOrPropertyWithValue("subStubSettings.endpoint", "test.endpoint") .hasFieldOrPropertyWithValue("subStubSettings.universeDomain", "example.com"); diff --git a/spring-cloud-previews/google-cloud-language-spring-starter/src/test/java/com/google/cloud/language/v2/spring/LanguageAutoConfigurationTests.java b/spring-cloud-previews/google-cloud-language-spring-starter/src/test/java/com/google/cloud/language/v2/spring/LanguageAutoConfigurationTests.java index fcc1f2af4c..09c534bf09 100644 --- a/spring-cloud-previews/google-cloud-language-spring-starter/src/test/java/com/google/cloud/language/v2/spring/LanguageAutoConfigurationTests.java +++ b/spring-cloud-previews/google-cloud-language-spring-starter/src/test/java/com/google/cloud/language/v2/spring/LanguageAutoConfigurationTests.java @@ -18,7 +18,6 @@ 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; @@ -198,8 +197,6 @@ 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);