1414package com .querydsl .core ;
1515
1616import static org .assertj .core .api .Assertions .assertThat ;
17+ import static org .assertj .core .api .AssertionsForClassTypes .assertThatExceptionOfType ;
1718
1819import com .querydsl .core .types .ExpressionUtils ;
1920import com .querydsl .core .types .Templates ;
2021import com .querydsl .core .types .ToStringVisitor ;
2122import com .querydsl .core .types .dsl .BooleanExpression ;
2223import com .querydsl .core .types .dsl .Expressions ;
23- import org .junit .Ignore ;
24- import org .junit .Test ;
24+ import org .junit .jupiter . api . Disabled ;
25+ import org .junit .jupiter . api . Test ;
2526
26- public class BooleanBuilderTest {
27+ class BooleanBuilderTest {
2728
2829 private final BooleanExpression first = BooleanConstant .TRUE ;
2930
3031 private final BooleanExpression second = BooleanConstant .FALSE ;
3132
3233 @ Test
33- public void null_in_constructor () {
34+ void null_in_constructor () {
3435 assertThat (new BooleanBuilder (null ).getValue ()).isNull ();
3536 }
3637
3738 @ Test
38- public void and_empty () {
39+ void and_empty () {
3940 var builder = new BooleanBuilder ();
4041 builder .and (new BooleanBuilder ());
4142 assertThat (ExpressionUtils .extract (builder )).isNull ();
4243 }
4344
4445 @ Test
45- public void and_any_of () {
46+ void and_any_of () {
4647 var builder = new BooleanBuilder ();
4748 builder .andAnyOf (first , null );
4849 assertThat (builder .getValue ()).isEqualTo (first );
4950 }
5051
5152 @ Test
52- public void and_any_of2 () {
53+ void and_any_of2 () {
5354 var builder = new BooleanBuilder ();
5455 builder .andAnyOf (null , first );
5556 assertThat (builder .getValue ()).isEqualTo (first );
5657 }
5758
5859 @ Test
59- public void or_all_of () {
60+ void or_all_of () {
6061 var builder = new BooleanBuilder ();
6162 builder .orAllOf (first , null );
6263 assertThat (builder .getValue ()).isEqualTo (first );
6364 }
6465
6566 @ Test
66- public void or_all_of2 () {
67+ void or_all_of2 () {
6768 var builder = new BooleanBuilder ();
6869 builder .orAllOf (null , first );
6970 assertThat (builder .getValue ()).isEqualTo (first );
7071 }
7172
72- @ Test (expected = QueryException .class )
73- @ Ignore
74- public void wrapped_booleanBuilder () {
75- new BooleanBuilder (new BooleanBuilder ());
73+ @ Test
74+ @ Disabled
75+ void wrapped_booleanBuilder () {
76+ assertThatExceptionOfType (QueryException .class )
77+ .isThrownBy (
78+ () -> {
79+ new BooleanBuilder (new BooleanBuilder ());
80+ });
7681 }
7782
7883 @ Test
79- public void basic () {
84+ void basic () {
8085 // new BooleanBuilder().and(first).or(second);
81- assertThat (new BooleanBuilder ().and (first ).or (second ).toString ())
82- .isEqualTo (first .or (second ).toString ());
86+ assertThat (new BooleanBuilder ().and (first ).or (second )).hasToString (first .or (second ).toString ());
8387 }
8488
8589 @ Test
86- public void advanced () {
90+ void advanced () {
8791 var builder = new BooleanBuilder ();
8892 builder .andAnyOf (first , second , first );
8993 builder .orAllOf (first , second , first );
9094 assertThat (builder ).hasToString ("true || false || true || true && false && true" );
9195 }
9296
9397 @ Test
94- public void if_then_else () {
98+ void if_then_else () {
9599 var builder = new BooleanBuilder ();
96100 builder .and (null );
97101 builder .or (null );
@@ -100,60 +104,59 @@ public void if_then_else() {
100104 }
101105
102106 @ Test
103- public void and_null_supported () {
107+ void and_null_supported () {
104108 assertThat (first .and (null )).isEqualTo (first );
105109 }
106110
107111 @ Test
108- public void or_null_supported () {
112+ void or_null_supported () {
109113 assertThat (first .or (null )).isEqualTo (first );
110114 }
111115
112116 @ Test
113- public void and_not () {
117+ void and_not () {
114118 var builder = new BooleanBuilder ();
115119 builder .and (first ).andNot (second );
116120 assertThat (builder .getValue ()).isEqualTo (first .and (second .not ()));
117121 }
118122
119123 @ Test
120- public void or_not () {
124+ void or_not () {
121125 var builder = new BooleanBuilder ();
122126 builder .and (first ).orNot (second );
123127 assertThat (builder .getValue ()).isEqualTo (first .or (second .not ()));
124128 }
125129
126130 @ Test
127- public void not () {
131+ void not () {
128132 var builder = new BooleanBuilder ();
129133 builder .and (first ).not ();
130134 assertThat (builder .getValue ()).isEqualTo (first .not ());
131135 }
132136
133137 @ Test
134- public void booleanBuilder_equals_booleanBuilder () {
138+ void booleanBuilder_equals_booleanBuilder () {
135139 assertThat (new BooleanBuilder (first )).isEqualTo (new BooleanBuilder (first ));
136140 }
137141
138142 @ Test
139- public void constant_equals_booleanBuilder () {
140- assertThat (first . equals (new BooleanBuilder (first ))). isFalse ( );
143+ void constant_equals_booleanBuilder () {
144+ assertThat (first ). isNotEqualTo (new BooleanBuilder (first ));
141145 }
142146
143147 @ Test
144- public void booleanBuilder_equals_constant () {
145- assertThat (new BooleanBuilder (first ). equals ( first )). isFalse ( );
148+ void booleanBuilder_equals_constant () {
149+ assertThat (new BooleanBuilder (first )). isNotEqualTo ( first );
146150 }
147151
148152 @ Test
149- public void hashCode_ () {
150- assertThat (new BooleanBuilder (first ).hashCode ())
151- .isEqualTo (new BooleanBuilder (first ).hashCode ());
152- assertThat (new BooleanBuilder ().hashCode ()).isEqualTo (new BooleanBuilder ().hashCode ());
153+ void hashCode_ () {
154+ assertThat (new BooleanBuilder (first )).hasSameHashCodeAs (new BooleanBuilder (first ));
155+ assertThat (new BooleanBuilder ()).hasSameHashCodeAs (new BooleanBuilder ());
153156 }
154157
155158 @ Test
156- public void toString_ () {
159+ void toString_ () {
157160 var builder = new BooleanBuilder ().and (first );
158161 assertThat (builder ).hasToString ("true" );
159162 builder .or (Expressions .booleanPath ("condition" ));
@@ -173,7 +176,7 @@ public void toString_() {
173176 // }
174177
175178 @ Test
176- public void accept () {
179+ void accept () {
177180 var builder = new BooleanBuilder ();
178181 builder .and (first );
179182 builder .or (Expressions .booleanPath ("condition" ));
0 commit comments