27
27
import java .time .LocalDate ;
28
28
import java .util .Arrays ;
29
29
import java .util .List ;
30
+ import java .util .UUID ;
30
31
31
32
import static com .github .mhewedy .expressions .model .Status .ACTIVE ;
32
33
import static com .github .mhewedy .expressions .model .Status .NOT_ACTIVE ;
@@ -58,7 +59,8 @@ public void setup() {
58
59
(short ) 1 ,
59
60
true ,
60
61
new Department (null , "hr" , new City (null , "cairo" )),
61
- Arrays .asList (new Task (null , "fix hr" , ACTIVE ), new Task (null , "fix hr" , ACTIVE ))
62
+ Arrays .asList (new Task (null , "fix hr" , ACTIVE ), new Task (null , "fix hr" , ACTIVE )),
63
+ UUID .fromString ("2dfb7bc7-38a6-4826-b6d3-297969d17244" )
62
64
),
63
65
new Employee (null ,
64
66
"mohammad" ,
@@ -70,7 +72,8 @@ public void setup() {
70
72
(short ) 1 ,
71
73
true ,
72
74
new Department (null , "sw arch" , new City (null , "giaz" )),
73
- Arrays .asList (new Task (null , "fix sw arch" , ACTIVE ), new Task (null , "fix sw arch" , ACTIVE ))
75
+ Arrays .asList (new Task (null , "fix sw arch" , ACTIVE ), new Task (null , "fix sw arch" , ACTIVE )),
76
+ UUID .randomUUID ()
74
77
),
75
78
new Employee (null ,
76
79
"mostafa" ,
@@ -82,7 +85,8 @@ public void setup() {
82
85
(short ) 2 ,
83
86
true ,
84
87
new Department (null , "sw dev" , new City (null , "alex" )),
85
- Arrays .asList (new Task (null , "fix sw dev" , ACTIVE ), new Task (null , "fix sw dev" , ACTIVE ))
88
+ Arrays .asList (new Task (null , "fix sw dev" , ACTIVE ), new Task (null , "fix sw dev" , ACTIVE )),
89
+ UUID .randomUUID ()
86
90
),
87
91
new Employee (null ,
88
92
"wael" ,
@@ -94,7 +98,8 @@ public void setup() {
94
98
(short ) 2 ,
95
99
true ,
96
100
new Department (null , "hr" , new City (null , "cairo" )),
97
- Arrays .asList (new Task (null , "fix hr" , ACTIVE ), new Task (null , "fix hr" , ACTIVE ))
101
+ Arrays .asList (new Task (null , "fix hr" , ACTIVE ), new Task (null , "fix hr" , ACTIVE )),
102
+ UUID .randomUUID ()
98
103
),
99
104
new Employee (null ,
100
105
"farida" ,
@@ -106,7 +111,8 @@ public void setup() {
106
111
(short ) 2 ,
107
112
false ,
108
113
new Department (null , "hr" , new City (null , "cairo" )),
109
- Arrays .asList (new Task (null , "fix hr" , ACTIVE ), new Task (null , "fix hr" , NOT_ACTIVE ))
114
+ Arrays .asList (new Task (null , "fix hr" , ACTIVE ), new Task (null , "fix hr" , NOT_ACTIVE )),
115
+ UUID .randomUUID ()
110
116
),
111
117
new Employee (null ,
112
118
"fofo" ,
@@ -118,7 +124,8 @@ public void setup() {
118
124
(short ) 2 ,
119
125
false ,
120
126
null ,
121
- null
127
+ null ,
128
+ UUID .randomUUID ()
122
129
)
123
130
);
124
131
employeeRepository .saveAll (employees );
@@ -540,6 +547,18 @@ public void testBooleanOperatorFromJava() {
540
547
// where e.active=?
541
548
}
542
549
550
+ @ Test
551
+ public void testUUID () throws Exception {
552
+ String json = loadResourceJsonFile ("testUUID" );
553
+
554
+ Expressions expressions = new ObjectMapper ().readValue (json , Expressions .class );
555
+
556
+ List <Employee > employeeList = employeeRepository .findAll (expressions );
557
+ assertThat (employeeList .size ()).isEqualTo (1 );
558
+
559
+ // where e.active=?
560
+ }
561
+
543
562
@ SneakyThrows
544
563
private String loadResourceJsonFile (String name ) {
545
564
File file = ResourceUtils .getFile ("classpath:" + name + ".json" );
0 commit comments