63
63
@ ExtendWith (MockitoExtension .class )
64
64
@ MockitoSettings (strictness = Strictness .LENIENT )
65
65
@ SuppressWarnings ({ "rawtypes" , "unchecked" })
66
- public class QueryByExamplePredicateBuilderUnitTests {
66
+ class QueryByExamplePredicateBuilderUnitTests {
67
67
68
68
@ Mock CriteriaBuilder cb ;
69
69
@ Mock Root root ;
@@ -74,20 +74,20 @@ public class QueryByExamplePredicateBuilderUnitTests {
74
74
@ Mock Path dummyPath ;
75
75
@ Mock Join from ;
76
76
77
- Set <SingularAttribute <? super Person , ?>> personEntityAttribtues ;
78
- Set <SingularAttribute <? super Skill , ?>> skillEntityAttribtues ;
77
+ private Set <SingularAttribute <? super Person , ?>> personEntityAttribtues ;
78
+ private Set <SingularAttribute <? super Skill , ?>> skillEntityAttribtues ;
79
79
80
- SingularAttribute <? super Person , Long > personIdAttribute ;
81
- SingularAttribute <? super Person , String > personFirstnameAttribute ;
82
- SingularAttribute <? super Person , Long > personAgeAttribute ;
83
- SingularAttribute <? super Person , Person > personFatherAttribute ;
84
- SingularAttribute <? super Person , Skill > personSkillAttribute ;
85
- SingularAttribute <? super Person , Address > personAddressAttribute ;
86
- SingularAttribute <? super Skill , String > skillNameAttribute ;
87
- SingularAttribute <? super Skill , Skill > skillNestedAttribute ;
80
+ private SingularAttribute <? super Person , Long > personIdAttribute ;
81
+ private SingularAttribute <? super Person , String > personFirstnameAttribute ;
82
+ private SingularAttribute <? super Person , Long > personAgeAttribute ;
83
+ private SingularAttribute <? super Person , Person > personFatherAttribute ;
84
+ private SingularAttribute <? super Person , Skill > personSkillAttribute ;
85
+ private SingularAttribute <? super Person , Address > personAddressAttribute ;
86
+ private SingularAttribute <? super Skill , String > skillNameAttribute ;
87
+ private SingularAttribute <? super Skill , Skill > skillNestedAttribute ;
88
88
89
89
@ BeforeEach
90
- public void setUp () {
90
+ void setUp () {
91
91
92
92
personIdAttribute = new SingularAttributeStub <>("id" , PersistentAttributeType .BASIC , Long .class );
93
93
personFirstnameAttribute = new SingularAttributeStub <>("firstname" , PersistentAttributeType .BASIC ,
@@ -135,31 +135,31 @@ public void setUp() {
135
135
}
136
136
137
137
@ Test // DATAJPA-218
138
- public void getPredicateShouldThrowExceptionOnNullRoot () {
138
+ void getPredicateShouldThrowExceptionOnNullRoot () {
139
139
assertThatIllegalArgumentException ().isThrownBy (
140
140
() -> QueryByExamplePredicateBuilder .getPredicate (null , cb , of (new Person ()), EscapeCharacter .DEFAULT ));
141
141
}
142
142
143
143
@ Test // DATAJPA-218
144
- public void getPredicateShouldThrowExceptionOnNullCriteriaBuilder () {
144
+ void getPredicateShouldThrowExceptionOnNullCriteriaBuilder () {
145
145
assertThatIllegalArgumentException ().isThrownBy (
146
146
() -> QueryByExamplePredicateBuilder .getPredicate (root , null , of (new Person ()), EscapeCharacter .DEFAULT ));
147
147
}
148
148
149
149
@ Test // DATAJPA-218
150
- public void getPredicateShouldThrowExceptionOnNullExample () {
150
+ void getPredicateShouldThrowExceptionOnNullExample () {
151
151
assertThatIllegalArgumentException ()
152
152
.isThrownBy (() -> QueryByExamplePredicateBuilder .getPredicate (root , null , null , EscapeCharacter .DEFAULT ));
153
153
}
154
154
155
155
@ Test // DATAJPA-218
156
- public void emptyCriteriaListShouldResultTruePredicate () {
156
+ void emptyCriteriaListShouldResultTruePredicate () {
157
157
assertThat (QueryByExamplePredicateBuilder .getPredicate (root , cb , of (new Person ()), EscapeCharacter .DEFAULT ))
158
158
.isEqualTo (truePredicate );
159
159
}
160
160
161
161
@ Test // DATAJPA-218
162
- public void singleElementCriteriaShouldJustReturnIt () {
162
+ void singleElementCriteriaShouldJustReturnIt () {
163
163
164
164
Person p = new Person ();
165
165
p .firstname = "foo" ;
@@ -170,7 +170,7 @@ public void singleElementCriteriaShouldJustReturnIt() {
170
170
}
171
171
172
172
@ Test // DATAJPA-218
173
- public void multiPredicateCriteriaShouldReturnCombinedOnes () {
173
+ void multiPredicateCriteriaShouldReturnCombinedOnes () {
174
174
175
175
Person p = new Person ();
176
176
p .firstname = "foo" ;
@@ -184,7 +184,7 @@ public void multiPredicateCriteriaShouldReturnCombinedOnes() {
184
184
}
185
185
186
186
@ Test // DATAJPA-879
187
- public void orConcatenatesPredicatesIfMatcherSpecifies () {
187
+ void orConcatenatesPredicatesIfMatcherSpecifies () {
188
188
189
189
Person person = new Person ();
190
190
person .firstname = "foo" ;
@@ -199,7 +199,7 @@ public void orConcatenatesPredicatesIfMatcherSpecifies() {
199
199
}
200
200
201
201
@ Test // DATAJPA-1372
202
- public void considersSingularJoinedAttributes () {
202
+ void considersSingularJoinedAttributes () {
203
203
204
204
doReturn (from ).when (root ).join (anyString ());
205
205
doReturn (dummyPath ).when (dummyPath ).get (any (SingularAttribute .class ));
@@ -219,7 +219,7 @@ public void considersSingularJoinedAttributes() {
219
219
}
220
220
221
221
@ Test // DATAJPA-1534
222
- public void likePatternsGetEscapedContaining () {
222
+ void likePatternsGetEscapedContaining () {
223
223
224
224
Person person = new Person ();
225
225
person .firstname = "f\\ o_o" ;
@@ -237,8 +237,7 @@ public void likePatternsGetEscapedContaining() {
237
237
}
238
238
239
239
@ Test // DATAJPA-1534
240
-
241
- public void likePatternsGetEscapedStarting () {
240
+ void likePatternsGetEscapedStarting () {
242
241
243
242
Person person = new Person ();
244
243
person .firstname = "f\\ o_o" ;
@@ -256,7 +255,7 @@ public void likePatternsGetEscapedStarting() {
256
255
}
257
256
258
257
@ Test // DATAJPA-1534
259
- public void likePatternsGetEscapedEnding () {
258
+ void likePatternsGetEscapedEnding () {
260
259
261
260
Person person = new Person ();
262
261
person .firstname = "f\\ o_o" ;
@@ -307,12 +306,12 @@ static class SingularAttributeStub<X, T> implements SingularAttribute<X, T> {
307
306
private Class <T > javaType ;
308
307
private Type <T > type ;
309
308
310
- public SingularAttributeStub (String name ,
309
+ SingularAttributeStub (String name ,
311
310
javax .persistence .metamodel .Attribute .PersistentAttributeType attributeType , Class <T > javaType ) {
312
311
this (name , attributeType , javaType , null );
313
312
}
314
313
315
- public SingularAttributeStub (String name ,
314
+ SingularAttributeStub (String name ,
316
315
javax .persistence .metamodel .Attribute .PersistentAttributeType attributeType , Class <T > javaType , Type <T > type ) {
317
316
this .name = name ;
318
317
this .attributeType = attributeType ;
0 commit comments