32
32
import com .querydsl .core .types .dsl .PathBuilder ;
33
33
import com .querydsl .jpa .JPQLQuery ;
34
34
35
+ import java .util .stream .Stream ;
36
+
35
37
/**
36
38
* Integration tests for {@link Querydsl}.
37
39
*
38
40
* @author Thomas Darimont
39
41
* @author Jens Schauder
42
+ * @author Marcus Voltolim
40
43
*/
41
44
@ RunWith (SpringJUnit4ClassRunner .class )
42
45
@ ContextConfiguration ({ "classpath:infrastructure.xml" })
@@ -52,7 +55,7 @@ public class QuerydslIntegrationTests {
52
55
@ Before
53
56
public void setup () {
54
57
55
- userPath = new PathBuilder <User >(User .class , "user" );
58
+ userPath = new PathBuilder <>(User .class , "user" );
56
59
querydsl = new Querydsl (em , userPath );
57
60
userQuery = querydsl .createQuery ().select (userPath );
58
61
}
@@ -67,4 +70,17 @@ public void defaultOrderingShouldNotGenerateAnNullOrderingHint() {
67
70
.doesNotContain ("nulls first" ) //
68
71
.doesNotContain ("nulls last" );
69
72
}
73
+
74
+ @ Test // DATAJPA-1198; DATAJPA-1779
75
+ public void orderWithIgnoreCaseAddLowerOnlyStringType () {
76
+ // firstname (String); id (Integer); dateOfBirth (Date)
77
+ Sort .Order [] orders = Stream .of ("firstname" , "id" , "dateOfBirth" ).map (name -> Sort .Order .asc (name ).ignoreCase ()).toArray (Sort .Order []::new );
78
+ JPQLQuery <User > result = querydsl .applySorting (Sort .by (orders ), userQuery );
79
+
80
+ assertThat (result ).isNotNull ();
81
+ assertThat (result .toString ()) //
82
+ .startsWith ("select user" ) //
83
+ .endsWith ("order by lower(user.firstname) asc, user.id asc, user.dateOfBirth asc" );
84
+ }
85
+
70
86
}
0 commit comments