Skip to content

Commit 45971b2

Browse files
mp911dechristophstrobl
authored andcommitted
Polishing.
Move off deprecated classes. Add unpaged testcase for query by example. Original Pull Request: spring-projects#3754
1 parent 68370c1 commit 45971b2

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/QuerydslMongoPredicateExecutor.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.springframework.data.querydsl.EntityPathResolver;
2828
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
2929
import org.springframework.data.querydsl.SimpleEntityPathResolver;
30-
import org.springframework.data.repository.support.PageableExecutionUtils;
30+
import org.springframework.data.support.PageableExecutionUtils;
3131
import org.springframework.util.Assert;
3232

3333
import com.querydsl.core.NonUniqueResultException;

Diff for: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import org.springframework.data.mongodb.core.query.Query;
3737
import org.springframework.data.mongodb.repository.MongoRepository;
3838
import org.springframework.data.mongodb.repository.query.MongoEntityInformation;
39-
import org.springframework.data.repository.support.PageableExecutionUtils;
39+
import org.springframework.data.support.PageableExecutionUtils;
4040
import org.springframework.data.util.StreamUtils;
4141
import org.springframework.data.util.Streamable;
4242
import org.springframework.lang.Nullable;

Diff for: spring-data-mongodb/src/test/java/org/springframework/data/mongodb/repository/support/SimpleMongoRepositoryTests.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@
3030
import org.junit.jupiter.api.BeforeEach;
3131
import org.junit.jupiter.api.Test;
3232
import org.junit.jupiter.api.extension.ExtendWith;
33+
3334
import org.springframework.data.domain.Example;
3435
import org.springframework.data.domain.Page;
3536
import org.springframework.data.domain.PageRequest;
36-
import org.springframework.data.domain.ExampleMatcher.*;
37+
import org.springframework.data.domain.Pageable;
3738
import org.springframework.data.geo.Point;
3839
import org.springframework.data.mongodb.MongoTransactionManager;
3940
import org.springframework.data.mongodb.core.geo.GeoJsonPoint;
@@ -177,6 +178,19 @@ void findByExampleShouldLookUpEntriesCorrectly() {
177178
assertThat(result.getTotalPages()).isEqualTo(1);
178179
}
179180

181+
@Test // GH-3751
182+
void findByExampleShouldReturnUnpagedResults() {
183+
184+
Person sample = new Person();
185+
sample.setLastname("Matthews");
186+
trimDomainType(sample, "id", "createdAt", "email");
187+
188+
Page<Person> result = repository.findAll(Example.of(sample), Pageable.unpaged());
189+
190+
assertThat(result.getContent()).hasSize(2).contains(dave, oliver);
191+
assertThat(result.getTotalPages()).isEqualTo(1);
192+
}
193+
180194
@Test // DATAMONGO-1464
181195
void findByExampleMultiplePagesShouldLookUpEntriesCorrectly() {
182196

0 commit comments

Comments
 (0)