2121
2222import java .util .List ;
2323import java .util .Optional ;
24+ import java .util .Set ;
2425import java .util .stream .Stream ;
2526
2627import org .hibernate .proxy .HibernateProxy ;
@@ -105,12 +106,19 @@ void beforeEach() {
105106 }
106107
107108 @ Test // GH-3830
108- void testDerivedFinderWithoutArguments () {
109+ void testDerivedQueryWithoutArguments () {
109110
110111 List <User > users = fragment .findUserNoArgumentsBy ();
111112 assertThat (users ).hasSize (7 ).hasOnlyElementsOfType (User .class );
112113 }
113114
115+ @ Test // GH-4094
116+ void testDerivedQueryAsSet () {
117+
118+ Set <User > users = fragment .findUserSetBy ();
119+ assertThat (users ).hasSize (7 ).hasOnlyElementsOfType (User .class );
120+ }
121+
114122 @ Test // GH-3830
115123 void testFindDerivedQuerySingleEntity () {
116124
@@ -119,7 +127,7 @@ void testFindDerivedQuerySingleEntity() {
119127 }
120128
121129 @ Test // GH-3830
122- void testFindDerivedFinderOptionalEntity () {
130+ void testFindDerivedQueryOptionalEntity () {
123131
124132 Optional <
User >
user =
fragment .
findOptionalOneByEmailAddress (
"[email protected] " );
125133 assertThat (user ).isNotNull ().containsInstanceOf (User .class )
@@ -141,7 +149,7 @@ void testDerivedExists() {
141149 }
142150
143151 @ Test // GH-3830
144- void testDerivedFinderReturningList () {
152+ void testDerivedQueryReturningList () {
145153
146154 List <User > users = fragment .findByLastnameStartingWith ("S" );
147155 assertThat (
users ).
extracting (
User ::
getEmailAddress ).
containsExactlyInAnyOrder (
"[email protected] " ,
"[email protected] " ,
@@ -157,44 +165,44 @@ void shouldReturnStream() {
157165 }
158166
159167 @ Test // GH-3830
160- void testLimitedDerivedFinder () {
168+ void testLimitedDerivedQuery () {
161169
162170 List <User > users = fragment .findTop2ByLastnameStartingWith ("S" );
163171 assertThat (users ).hasSize (2 );
164172 }
165173
166174 @ Test // GH-3830
167- void testSortedDerivedFinder () {
175+ void testSortedDerivedQuery () {
168176
169177 List <User > users = fragment .findByLastnameStartingWithOrderByEmailAddress ("S" );
170178 assertThat (
users ).
extracting (
User ::
getEmailAddress ).
containsExactly (
"[email protected] " ,
"[email protected] " ,
171179172180 }
173181
174182 @ Test // GH-3830
175- void testDerivedFinderWithLimitArgument () {
183+ void testDerivedQueryWithLimitArgument () {
176184
177185 List <User > users = fragment .findByLastnameStartingWith ("S" , Limit .of (2 ));
178186 assertThat (users ).hasSize (2 );
179187 }
180188
181189 @ Test // GH-3830
182- void testDerivedFinderWithSort () {
190+ void testDerivedQueryWithSort () {
183191
184192 List <User > users = fragment .findByLastnameStartingWith ("S" , Sort .by ("emailAddress" ));
185193 assertThat (
users ).
extracting (
User ::
getEmailAddress ).
containsExactly (
"[email protected] " ,
"[email protected] " ,
186194187195 }
188196
189197 @ Test // GH-3830
190- void testDerivedFinderWithSortAndLimit () {
198+ void testDerivedQueryWithSortAndLimit () {
191199
192200 List <User > users = fragment .findByLastnameStartingWith ("S" , Sort .by ("emailAddress" ), Limit .of (2 ));
193201 assertThat (
users ).
extracting (
User ::
getEmailAddress ).
containsExactly (
"[email protected] " ,
"[email protected] " );
194202 }
195203
196204 @ Test // GH-3830
197- void testDerivedFinderReturningListWithPageable () {
205+ void testDerivedQueryReturningListWithPageable () {
198206
199207 List <User > users = fragment .findByLastnameStartingWith ("S" , PageRequest .of (0 , 2 , Sort .by ("emailAddress" )));
200208 assertThat (
users ).
extracting (
User ::
getEmailAddress ).
containsExactly (
"[email protected] " ,
"[email protected] " );
@@ -208,7 +216,7 @@ void testDerivedQueryMethodReturningStreamable() {
208216 }
209217
210218 @ Test // GH-3830
211- void testDerivedFinderReturningPage () {
219+ void testDerivedQueryReturningPage () {
212220
213221 Page <User > page = fragment .findPageOfUsersByLastnameStartingWith ("S" ,
214222 PageRequest .of (0 , 2 , Sort .by ("emailAddress" )));
@@ -220,7 +228,7 @@ void testDerivedFinderReturningPage() {
220228 }
221229
222230 @ Test // GH-3830
223- void testDerivedFinderReturningSlice () {
231+ void testDerivedQueryReturningSlice () {
224232
225233 Slice <User > slice = fragment .findSliceOfUserByLastnameStartingWith ("S" ,
226234 PageRequest .of (0 , 2 , Sort .by ("emailAddress" )));
@@ -374,15 +382,31 @@ void shouldEvaluateExpressionByPosition() {
374382 }
375383
376384 @ Test // GH-3830
377- void testDerivedFinderReturningListOfProjections () {
385+ void testDerivedQueryReturningListOfProjections () {
378386
379387 List <UserDtoProjection > users = fragment .findUserProjectionByLastnameStartingWith ("S" );
380388 assertThat (
users ).
extracting (
UserDtoProjection ::
getEmailAddress ).
containsExactlyInAnyOrder (
"[email protected] " ,
381389382390 }
383391
392+ @ Test // GH-4094
393+ void testDerivedQueryReturningSetOfProjections () {
394+
395+ Set <UserDtoProjection > users = fragment .findUserProjectionSetByLastnameStartingWith ("S" );
396+ assertThat (
users ).
extracting (
UserDtoProjection ::
getEmailAddress ).
containsExactlyInAnyOrder (
"[email protected] " ,
397+ 398+ }
399+
400+ @ Test // GH-4094
401+ void testDerivedQueryReturningStreamableOfProjections () {
402+
403+ Streamable <UserDtoProjection > users = fragment .findUserProjectionStreamableByLastnameStartingWith ("S" );
404+ assertThat (
users ).
extracting (
UserDtoProjection ::
getEmailAddress ).
containsExactlyInAnyOrder (
"[email protected] " ,
405+ 406+ }
407+
384408 @ Test // GH-3830
385- void testDerivedFinderReturningPageOfProjections () {
409+ void testDerivedQueryReturningPageOfProjections () {
386410
387411 Page <UserDtoProjection > page = fragment .findUserProjectionByLastnameStartingWith ("S" ,
388412 PageRequest .of (0 , 2 , Sort .by ("emailAddress" )));
0 commit comments