Skip to content

Commit b9a23ba

Browse files
committed
Adopt to Mockito 5.1 changes.
See #4290
1 parent d1326a4 commit b9a23ba

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SimpleReactiveMongoRepositoryUnitTests.java

+5-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.mockito.ArgumentCaptor;
2929
import org.mockito.Mock;
3030
import org.mockito.junit.jupiter.MockitoExtension;
31-
3231
import org.springframework.data.domain.Example;
3332
import org.springframework.data.domain.Sort;
3433
import org.springframework.data.mongodb.core.ReactiveMongoOperations;
@@ -43,8 +42,6 @@
4342
class SimpleReactiveMongoRepositoryUnitTests {
4443

4544
private SimpleReactiveMongoRepository<Object, String> repository;
46-
@Mock Mono mono;
47-
@Mock Flux flux;
4845
@Mock ReactiveMongoOperations mongoOperations;
4946
@Mock MongoEntityInformation<Object, String> entityInformation;
5047

@@ -56,7 +53,7 @@ void setUp() {
5653
@Test // DATAMONGO-1854
5754
void shouldAddDefaultCollationToCountForExampleIfPresent() {
5855

59-
when(mongoOperations.count(any(), any(), any())).thenReturn(mono);
56+
when(mongoOperations.count(any(), any(), any())).thenReturn(Mono.just(0L));
6057

6158
Collation collation = Collation.of("en_US");
6259

@@ -72,7 +69,7 @@ void shouldAddDefaultCollationToCountForExampleIfPresent() {
7269
@Test // DATAMONGO-1854
7370
void shouldAddDefaultCollationToExistsForExampleIfPresent() {
7471

75-
when(mongoOperations.exists(any(), any(), any())).thenReturn(mono);
72+
when(mongoOperations.exists(any(), any(), any())).thenReturn(Mono.just(false));
7673

7774
Collation collation = Collation.of("en_US");
7875

@@ -88,7 +85,7 @@ void shouldAddDefaultCollationToExistsForExampleIfPresent() {
8885
@Test // DATAMONGO-1854
8986
void shouldAddDefaultCollationToFindForExampleIfPresent() {
9087

91-
when(mongoOperations.find(any(), any(), any())).thenReturn(flux);
88+
when(mongoOperations.find(any(), any(), any())).thenReturn(Flux.empty());
9289

9390
Collation collation = Collation.of("en_US");
9491

@@ -104,7 +101,7 @@ void shouldAddDefaultCollationToFindForExampleIfPresent() {
104101
@Test // DATAMONGO-1854
105102
void shouldAddDefaultCollationToFindWithSortForExampleIfPresent() {
106103

107-
when(mongoOperations.find(any(), any(), any())).thenReturn(flux);
104+
when(mongoOperations.find(any(), any(), any())).thenReturn(Flux.empty());
108105

109106
Collation collation = Collation.of("en_US");
110107

@@ -120,7 +117,7 @@ void shouldAddDefaultCollationToFindWithSortForExampleIfPresent() {
120117
@Test // DATAMONGO-1854
121118
void shouldAddDefaultCollationToFindOneForExampleIfPresent() {
122119

123-
when(mongoOperations.find(any(), any(), any())).thenReturn(flux);
120+
when(mongoOperations.find(any(), any(), any())).thenReturn(Flux.empty());
124121

125122
Collation collation = Collation.of("en_US");
126123

0 commit comments

Comments
 (0)