use of org.springframework.data.mongodb.core.query.Collation in project spring-data-mongodb by spring-projects.
the class SimpleReactiveMongoRepositoryUnitTests method shouldAddDefaultCollationToCountForExampleIfPresent.
// DATAMONGO-1854
@Test
void shouldAddDefaultCollationToCountForExampleIfPresent() {
when(mongoOperations.count(any(), any(), any())).thenReturn(mono);
Collation collation = Collation.of("en_US");
when(entityInformation.getCollation()).thenReturn(collation);
repository.count(Example.of(new TestDummy())).subscribe();
ArgumentCaptor<Query> query = ArgumentCaptor.forClass(Query.class);
verify(mongoOperations).count(query.capture(), any(), any());
assertThat(query.getValue().getCollation()).contains(collation);
}
use of org.springframework.data.mongodb.core.query.Collation in project spring-data-mongodb by spring-projects.
the class SimpleReactiveMongoRepositoryUnitTests method shouldAddDefaultCollationToFindForExampleIfPresent.
// DATAMONGO-1854
@Test
void shouldAddDefaultCollationToFindForExampleIfPresent() {
when(mongoOperations.find(any(), any(), any())).thenReturn(flux);
Collation collation = Collation.of("en_US");
when(entityInformation.getCollation()).thenReturn(collation);
repository.findAll(Example.of(new TestDummy())).subscribe();
ArgumentCaptor<Query> query = ArgumentCaptor.forClass(Query.class);
verify(mongoOperations).find(query.capture(), any(), any());
assertThat(query.getValue().getCollation()).contains(collation);
}
use of org.springframework.data.mongodb.core.query.Collation in project spring-data-mongodb by spring-projects.
the class SimpleReactiveMongoRepositoryUnitTests method shouldAddDefaultCollationToFindWithSortForExampleIfPresent.
// DATAMONGO-1854
@Test
void shouldAddDefaultCollationToFindWithSortForExampleIfPresent() {
when(mongoOperations.find(any(), any(), any())).thenReturn(flux);
Collation collation = Collation.of("en_US");
when(entityInformation.getCollation()).thenReturn(collation);
repository.findAll(Example.of(new TestDummy()), Sort.by("nothing")).subscribe();
ArgumentCaptor<Query> query = ArgumentCaptor.forClass(Query.class);
verify(mongoOperations).find(query.capture(), any(), any());
assertThat(query.getValue().getCollation()).contains(collation);
}
Aggregations