|
42 | 42 | import org.junit.jupiter.params.ParameterizedTest; |
43 | 43 | import org.junit.jupiter.params.provider.Arguments; |
44 | 44 | import org.junit.jupiter.params.provider.MethodSource; |
45 | | - |
46 | 45 | import org.springframework.beans.factory.annotation.Autowired; |
47 | 46 | import org.springframework.beans.factory.config.PropertiesFactoryBean; |
48 | 47 | import org.springframework.context.ApplicationListener; |
|
52 | 51 | import org.springframework.core.io.ClassPathResource; |
53 | 52 | import org.springframework.dao.IncorrectResultSizeDataAccessException; |
54 | 53 | import org.springframework.data.annotation.Id; |
55 | | -import org.springframework.data.domain.Example; |
56 | | -import org.springframework.data.domain.ExampleMatcher; |
57 | | -import org.springframework.data.domain.Limit; |
58 | | -import org.springframework.data.domain.Page; |
59 | | -import org.springframework.data.domain.PageRequest; |
60 | | -import org.springframework.data.domain.Pageable; |
61 | | -import org.springframework.data.domain.ScrollPosition; |
62 | | -import org.springframework.data.domain.Slice; |
63 | | -import org.springframework.data.domain.Sort; |
64 | | -import org.springframework.data.domain.Window; |
| 54 | +import org.springframework.data.domain.*; |
65 | 55 | import org.springframework.data.jdbc.core.mapping.AggregateReference; |
66 | 56 | import org.springframework.data.jdbc.repository.query.Modifying; |
67 | 57 | import org.springframework.data.jdbc.repository.query.Query; |
@@ -924,19 +914,18 @@ void findAllByExamplePageable(Pageable pageRequest, int size, int totalPages, Li |
924 | 914 | } |
925 | 915 |
|
926 | 916 | @Test |
927 | | - void findByExampleWithCollection(){ |
| 917 | + void findByExampleWithCollection() { |
928 | 918 |
|
929 | 919 | List<Root> roots = rootRepository.saveAll(List.of(createRoot("one"), createRoot("two"))); |
930 | 920 |
|
931 | | - Example<Root> example = Example.of(new Root(null, "one", null, null)); |
| 921 | + Example<Root> example = Example |
| 922 | + .of(new Root(null, "one", null, List.of(new Intermediate(null, "peter", null, null)))); |
932 | 923 |
|
933 | | - Iterable<RootProjection> result = rootRepository.findAll(example); |
| 924 | + Iterable<Root> result = rootRepository.findAll(example); |
934 | 925 |
|
935 | 926 | assertThat(result).contains(roots.get(0)); |
936 | | - System.out.println(result); |
937 | 927 | } |
938 | 928 |
|
939 | | - |
940 | 929 | public static Stream<Arguments> findAllByExamplePageableSource() { |
941 | 930 | return Stream.of( // |
942 | 931 | Arguments.of(PageRequest.of(0, 3), 3, 34, Arrays.asList("3", "4", "100")), // |
@@ -1653,10 +1642,6 @@ public String toString() { |
1653 | 1642 | } |
1654 | 1643 | } |
1655 | 1644 |
|
1656 | | - interface RootProjection { |
1657 | | - String getName(); |
1658 | | - } |
1659 | | - |
1660 | 1645 | @Table("WITH_DELIMITED_COLUMN") |
1661 | 1646 | static class WithDelimitedColumn { |
1662 | 1647 | @Id Long id; |
|
0 commit comments