Polishing.
Move off deprecated classes. Add unpaged testcase for query by example. Original Pull Request: #3754
This commit is contained in:
committed by
Christoph Strobl
parent
68370c16fb
commit
45971b212c
@@ -27,7 +27,7 @@ import org.springframework.data.mongodb.repository.query.MongoEntityInformation;
|
||||
import org.springframework.data.querydsl.EntityPathResolver;
|
||||
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||
import org.springframework.data.querydsl.SimpleEntityPathResolver;
|
||||
import org.springframework.data.repository.support.PageableExecutionUtils;
|
||||
import org.springframework.data.support.PageableExecutionUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.querydsl.core.NonUniqueResultException;
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.mongodb.repository.query.MongoEntityInformation;
|
||||
import org.springframework.data.repository.support.PageableExecutionUtils;
|
||||
import org.springframework.data.support.PageableExecutionUtils;
|
||||
import org.springframework.data.util.StreamUtils;
|
||||
import org.springframework.data.util.Streamable;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
@@ -30,10 +30,11 @@ import java.util.UUID;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.ExampleMatcher.*;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.geo.Point;
|
||||
import org.springframework.data.mongodb.MongoTransactionManager;
|
||||
import org.springframework.data.mongodb.core.geo.GeoJsonPoint;
|
||||
@@ -177,6 +178,19 @@ class SimpleMongoRepositoryTests {
|
||||
assertThat(result.getTotalPages()).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test // GH-3751
|
||||
void findByExampleShouldReturnUnpagedResults() {
|
||||
|
||||
Person sample = new Person();
|
||||
sample.setLastname("Matthews");
|
||||
trimDomainType(sample, "id", "createdAt", "email");
|
||||
|
||||
Page<Person> result = repository.findAll(Example.of(sample), Pageable.unpaged());
|
||||
|
||||
assertThat(result.getContent()).hasSize(2).contains(dave, oliver);
|
||||
assertThat(result.getTotalPages()).isEqualTo(1);
|
||||
}
|
||||
|
||||
@Test // DATAMONGO-1464
|
||||
void findByExampleMultiplePagesShouldLookUpEntriesCorrectly() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user