28
28
import org .mockito .ArgumentCaptor ;
29
29
import org .mockito .Mock ;
30
30
import org .mockito .junit .jupiter .MockitoExtension ;
31
-
32
31
import org .springframework .data .domain .Example ;
33
32
import org .springframework .data .domain .Sort ;
34
33
import org .springframework .data .mongodb .core .ReactiveMongoOperations ;
43
42
class SimpleReactiveMongoRepositoryUnitTests {
44
43
45
44
private SimpleReactiveMongoRepository <Object , String > repository ;
46
- @ Mock Mono mono ;
47
- @ Mock Flux flux ;
48
45
@ Mock ReactiveMongoOperations mongoOperations ;
49
46
@ Mock MongoEntityInformation <Object , String > entityInformation ;
50
47
@@ -56,7 +53,7 @@ void setUp() {
56
53
@ Test // DATAMONGO-1854
57
54
void shouldAddDefaultCollationToCountForExampleIfPresent () {
58
55
59
- when (mongoOperations .count (any (), any (), any ())).thenReturn (mono );
56
+ when (mongoOperations .count (any (), any (), any ())).thenReturn (Mono . empty () );
60
57
61
58
Collation collation = Collation .of ("en_US" );
62
59
@@ -72,7 +69,7 @@ void shouldAddDefaultCollationToCountForExampleIfPresent() {
72
69
@ Test // DATAMONGO-1854
73
70
void shouldAddDefaultCollationToExistsForExampleIfPresent () {
74
71
75
- when (mongoOperations .exists (any (), any (), any ())).thenReturn (mono );
72
+ when (mongoOperations .exists (any (), any (), any ())).thenReturn (Mono . empty () );
76
73
77
74
Collation collation = Collation .of ("en_US" );
78
75
@@ -88,7 +85,7 @@ void shouldAddDefaultCollationToExistsForExampleIfPresent() {
88
85
@ Test // DATAMONGO-1854
89
86
void shouldAddDefaultCollationToFindForExampleIfPresent () {
90
87
91
- when (mongoOperations .find (any (), any (), any ())).thenReturn (flux );
88
+ when (mongoOperations .find (any (), any (), any ())).thenReturn (Flux . empty () );
92
89
93
90
Collation collation = Collation .of ("en_US" );
94
91
@@ -104,7 +101,7 @@ void shouldAddDefaultCollationToFindForExampleIfPresent() {
104
101
@ Test // DATAMONGO-1854
105
102
void shouldAddDefaultCollationToFindWithSortForExampleIfPresent () {
106
103
107
- when (mongoOperations .find (any (), any (), any ())).thenReturn (flux );
104
+ when (mongoOperations .find (any (), any (), any ())).thenReturn (Flux . empty () );
108
105
109
106
Collation collation = Collation .of ("en_US" );
110
107
@@ -120,7 +117,8 @@ void shouldAddDefaultCollationToFindWithSortForExampleIfPresent() {
120
117
@ Test // DATAMONGO-1854
121
118
void shouldAddDefaultCollationToFindOneForExampleIfPresent () {
122
119
123
- when (mongoOperations .find (any (), any (), any ())).thenReturn (flux );
120
+ when (entityInformation .getCollectionName ()).thenReturn ("testdummy" );
121
+ doReturn (Flux .empty ()).when (mongoOperations ).find (any (Query .class ), eq (TestDummy .class ), eq ("testdummy" ));
124
122
125
123
Collation collation = Collation .of ("en_US" );
126
124
0 commit comments