From b9a23baf16f7d990a2a2abf159319a37f62f73e7 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Tue, 11 Apr 2023 08:34:37 +0200 Subject: [PATCH] Adopt to Mockito 5.1 changes. See #4290 --- .../SimpleReactiveMongoRepositoryUnitTests.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SimpleReactiveMongoRepositoryUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SimpleReactiveMongoRepositoryUnitTests.java index 0e66f2602..014035049 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SimpleReactiveMongoRepositoryUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SimpleReactiveMongoRepositoryUnitTests.java @@ -28,7 +28,6 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; - import org.springframework.data.domain.Example; import org.springframework.data.domain.Sort; import org.springframework.data.mongodb.core.ReactiveMongoOperations; @@ -43,8 +42,6 @@ import org.springframework.data.mongodb.repository.query.MongoEntityInformation; class SimpleReactiveMongoRepositoryUnitTests { private SimpleReactiveMongoRepository repository; - @Mock Mono mono; - @Mock Flux flux; @Mock ReactiveMongoOperations mongoOperations; @Mock MongoEntityInformation entityInformation; @@ -56,7 +53,7 @@ class SimpleReactiveMongoRepositoryUnitTests { @Test // DATAMONGO-1854 void shouldAddDefaultCollationToCountForExampleIfPresent() { - when(mongoOperations.count(any(), any(), any())).thenReturn(mono); + when(mongoOperations.count(any(), any(), any())).thenReturn(Mono.just(0L)); Collation collation = Collation.of("en_US"); @@ -72,7 +69,7 @@ class SimpleReactiveMongoRepositoryUnitTests { @Test // DATAMONGO-1854 void shouldAddDefaultCollationToExistsForExampleIfPresent() { - when(mongoOperations.exists(any(), any(), any())).thenReturn(mono); + when(mongoOperations.exists(any(), any(), any())).thenReturn(Mono.just(false)); Collation collation = Collation.of("en_US"); @@ -88,7 +85,7 @@ class SimpleReactiveMongoRepositoryUnitTests { @Test // DATAMONGO-1854 void shouldAddDefaultCollationToFindForExampleIfPresent() { - when(mongoOperations.find(any(), any(), any())).thenReturn(flux); + when(mongoOperations.find(any(), any(), any())).thenReturn(Flux.empty()); Collation collation = Collation.of("en_US"); @@ -104,7 +101,7 @@ class SimpleReactiveMongoRepositoryUnitTests { @Test // DATAMONGO-1854 void shouldAddDefaultCollationToFindWithSortForExampleIfPresent() { - when(mongoOperations.find(any(), any(), any())).thenReturn(flux); + when(mongoOperations.find(any(), any(), any())).thenReturn(Flux.empty()); Collation collation = Collation.of("en_US"); @@ -120,7 +117,7 @@ class SimpleReactiveMongoRepositoryUnitTests { @Test // DATAMONGO-1854 void shouldAddDefaultCollationToFindOneForExampleIfPresent() { - when(mongoOperations.find(any(), any(), any())).thenReturn(flux); + when(mongoOperations.find(any(), any(), any())).thenReturn(Flux.empty()); Collation collation = Collation.of("en_US");