2828import org .mockito .ArgumentCaptor ;
2929import org .mockito .Mock ;
3030import org .mockito .junit .jupiter .MockitoExtension ;
31-
3231import org .springframework .data .domain .Example ;
3332import org .springframework .data .domain .Sort ;
3433import org .springframework .data .mongodb .core .ReactiveMongoOperations ;
4342class 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 . empty () );
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 . empty () );
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,8 @@ void shouldAddDefaultCollationToFindWithSortForExampleIfPresent() {
120117 @ Test // DATAMONGO-1854
121118 void shouldAddDefaultCollationToFindOneForExampleIfPresent () {
122119
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" ));
124122
125123 Collation collation = Collation .of ("en_US" );
126124
0 commit comments