Skip to content

Commit 498728a

Browse files
committed
Fix test in "Add autoconfiguration for ReactivePulsarListener"
1 parent 4944be6 commit 498728a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spring-pulsar-spring-boot-autoconfigure/src/test/java/org/springframework/pulsar/autoconfigure/PulsarReactiveAutoConfigurationTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.pulsar.autoconfigure;
1818

1919
import static org.assertj.core.api.Assertions.assertThat;
20+
import static org.mockito.ArgumentMatchers.any;
2021
import static org.mockito.Mockito.mock;
2122

2223
import java.util.concurrent.TimeUnit;
@@ -268,7 +269,9 @@ void defaultClientCacheIsUsedIfCaffeineProducerCacheProviderNotOnClasspath() {
268269
ReactiveMessageSenderCache cache = AdaptedReactivePulsarClientFactory.createCache();
269270
try (MockedStatic<AdaptedReactivePulsarClientFactory> mockedClientFactory = Mockito
270271
.mockStatic(AdaptedReactivePulsarClientFactory.class)) {
271-
mockedClientFactory.when(AdaptedReactivePulsarClientFactory::createCache).thenReturn(cache);
272+
mockedClientFactory.when(() -> AdaptedReactivePulsarClientFactory.createCache()).thenReturn(cache);
273+
mockedClientFactory.when(() -> AdaptedReactivePulsarClientFactory.create(any(PulsarClient.class)))
274+
.thenReturn(mock(ReactivePulsarClient.class));
272275
contextRunner.withClassLoader(new FilteredClassLoader(CaffeineProducerCacheProvider.class))
273276
.run((context) -> assertThat(context).hasNotFailed()
274277
.doesNotHaveBean(ProducerCacheProvider.class)

0 commit comments

Comments
 (0)