17
17
18
18
import static org .hamcrest .Matchers .*;
19
19
import static org .junit .Assert .*;
20
+ import static org .springframework .data .querydsl .QQSortUnitTests_WrapperToWrapWrapperForUserWrapper .*;
21
+ import static org .springframework .data .querydsl .QQSortUnitTests_WrapperToWrapWrapperForUserWrapper_WrapperForUserWrapper .*;
22
+ import static org .springframework .data .querydsl .QQSortUnitTests_WrapperToWrapWrapperForUserWrapper_WrapperForUserWrapper_UserWrapper .*;
20
23
21
24
import java .util .List ;
22
25
26
29
import org .springframework .data .domain .Sort .Direction ;
27
30
import org .springframework .data .domain .Sort .Order ;
28
31
32
+ import com .mysema .query .annotations .QueryEntity ;
33
+ import com .mysema .query .annotations .QueryInit ;
29
34
import com .mysema .query .types .OrderSpecifier ;
30
35
31
36
/**
@@ -171,7 +176,7 @@ public void shouldSupportSortByOperatorExpressions() {
171
176
@ Test
172
177
public void shouldCreateSortForNestedPathCorrectly () {
173
178
174
- QSort sort = new QSort (QUserWrapper . userWrapper .user .firstname .asc ());
179
+ QSort sort = new QSort (userWrapper .user .firstname .asc ());
175
180
176
181
assertThat (sort , hasItems (new Order (Direction .ASC , "user.firstname" )));
177
182
}
@@ -182,7 +187,7 @@ public void shouldCreateSortForNestedPathCorrectly() {
182
187
@ Test
183
188
public void shouldCreateSortForDeepNestedPathCorrectly () {
184
189
185
- QSort sort = new QSort (QWrapperForUserWrapper . wrapperForUserWrapper .wrapper .user .firstname .asc ());
190
+ QSort sort = new QSort (wrapperForUserWrapper .wrapper .user .firstname .asc ());
186
191
187
192
assertThat (sort , hasItems (new Order (Direction .ASC , "wrapper.user.firstname" )));
188
193
}
@@ -193,10 +198,27 @@ public void shouldCreateSortForDeepNestedPathCorrectly() {
193
198
@ Test
194
199
public void shouldCreateSortForReallyDeepNestedPathCorrectly () {
195
200
196
- QSort sort = new QSort (
197
- QWrapperToWrapWrapperForUserWrapper .wrapperToWrapWrapperForUserWrapper .wrapperForUserWrapper .wrapper .user .firstname
198
- .asc ());
201
+ QSort sort = new QSort (wrapperToWrapWrapperForUserWrapper .wrapperForUserWrapper .wrapper .user .firstname .asc ());
199
202
200
203
assertThat (sort , hasItems (new Order (Direction .ASC , "wrapperForUserWrapper.wrapper.user.firstname" )));
201
204
}
205
+
206
+ @ QueryEntity
207
+ static class WrapperToWrapWrapperForUserWrapper {
208
+
209
+ @ QueryInit ("wrapper.user" )//
210
+ WrapperForUserWrapper wrapperForUserWrapper ;
211
+
212
+ @ QueryEntity
213
+ static class WrapperForUserWrapper {
214
+
215
+ UserWrapper wrapper ;
216
+
217
+ @ QueryEntity
218
+ static class UserWrapper {
219
+
220
+ User user ;
221
+ }
222
+ }
223
+ }
202
224
}
0 commit comments