@@ -39,7 +39,7 @@ public void testGenerate_textField() throws JsonProcessingException {
39
39
40
40
Assert .assertThat (json , hasJsonPath ("$.schema.properties.firstName.title" ,equalTo ("First Name" )));
41
41
Assert .assertThat (json , hasJsonPath ("$.schema.properties.firstName.pattern" ,equalTo ("[a-z]" )));
42
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='firstName')].key " ,hasSize (1 )));
42
+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='firstName')]" ,hasSize (1 )));
43
43
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='firstName')].description" ,hasItem ("This is a description for your first name field" )));
44
44
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='firstName')].placeholder" ,hasItem ("Your first name" )));
45
45
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='firstName')].validationMessage" ,hasItem ("this is a validation msg" )));
@@ -52,7 +52,7 @@ public void testGenerate_Number() throws JsonProcessingException {
52
52
UiForm ui = UiFormSchemaGenerator .get ().generate (NumberForm .class );
53
53
String json = new ObjectMapper ().writeValueAsString (ui );
54
54
//Assert.assertThat(json, hasJsonPath("$.schema.properties.number.title",equalTo("Number")));
55
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='number')].key " ,hasSize (1 )));
55
+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='number')]" ,hasSize (1 )));
56
56
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='number')].description" ,hasItem ("This is a number" )));
57
57
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='number')].placeholder" ,hasItem ("Number of children" )));
58
58
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='number')].validationMessage" ,hasItem ("this is a validation msg" )));
@@ -68,7 +68,7 @@ public void testGenerate_Password() throws JsonProcessingException {
68
68
69
69
String json = new ObjectMapper ().writeValueAsString (ui );
70
70
Assert .assertThat (json , hasJsonPath ("$.schema.properties.password.title" ,equalTo ("Password" )));
71
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='password')].key " ,hasSize (1 )));
71
+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='password')]" ,hasSize (1 )));
72
72
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='password')].description" ,hasItem ("This is password" )));
73
73
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='password')].placeholder" ,hasItem ("Please set you password" )));
74
74
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='password')].validationMessage" ,hasItem ("this is a validation msg" )));
@@ -83,7 +83,7 @@ public void testGenerate_TextArea() throws JsonProcessingException {
83
83
84
84
String json = new ObjectMapper ().writeValueAsString (ui );
85
85
Assert .assertThat (json , hasJsonPath ("$.schema.properties.address.title" ,equalTo ("Address" )));
86
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].key " ,hasSize (1 )));
86
+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')]" ,hasSize (1 )));
87
87
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].description" ,hasItem ("This is textarea" )));
88
88
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].placeholder" ,hasItem ("Fill your address please" )));
89
89
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].validationMessage" ,hasItem ("this is a validation msg" )));
@@ -98,23 +98,20 @@ public void testGenerate_CheckBox() throws JsonProcessingException {
98
98
UiForm ui = UiFormSchemaGenerator .get ().generate (CheckBoxForm .class );
99
99
String json = new ObjectMapper ().writeValueAsString (ui );
100
100
Assert .assertThat (json , hasJsonPath ("$.schema.properties.color.title" ,equalTo ("Color" )));
101
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].key " ,hasSize (1 )));
101
+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')]" ,hasSize (1 )));
102
102
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].multiple" ,hasItem (false )));
103
103
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].required" ,hasItem (true )));
104
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].titleMap[0].name" ,hasItem ("Red" )));
105
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].titleMap[0].value" ,hasItem ("red" )));
106
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].titleMap[1].name" ,hasItem ("Blue" )));
107
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].titleMap[1].value" ,hasItem ("blue" )));
108
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].titleMap[2].name" ,hasItem ("Green" )));
109
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].titleMap[2].value" ,hasItem ("green" )));
104
+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].titleMap[?(@.name=='Red')].value" ,hasItem ("red" )));
105
+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].titleMap[?(@.name=='Blue')].value" ,hasItem ("blue" )));
106
+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].titleMap[?(@.name=='Green')].value" ,hasItem ("green" )));
110
107
}
111
108
112
109
@ Test
113
110
public void testGenerate_CheckBox_WithCustomValuesContainer () throws JsonProcessingException {
114
111
UiForm ui = UiFormSchemaGenerator .get ().generate (CheckBoxForm2 .class );
115
112
String json = new ObjectMapper ().writeValueAsString (ui );
116
113
Assert .assertThat (json , hasJsonPath ("$.schema.properties.color.title" ,equalTo ("Color" )));
117
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].key " ,hasSize (1 )));
114
+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')]" ,hasSize (1 )));
118
115
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].multiple" ,hasItem (true )));
119
116
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].required" ,hasItem (false )));
120
117
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='color')].titleMap[?(@.name=='Red')].value" ,hasItem ("red" )));
@@ -127,7 +124,7 @@ public void testGenerate_RadioBox() throws JsonProcessingException {
127
124
UiForm ui = UiFormSchemaGenerator .get ().generate (RadioBoxForm .class );
128
125
String json = new ObjectMapper ().writeValueAsString (ui );
129
126
Assert .assertThat (json , hasJsonPath ("$.schema.properties.civilState.title" ,equalTo ("Civil State" )));
130
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='civilState')].key " ,hasSize (1 )));
127
+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='civilState')]" ,hasSize (1 )));
131
128
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='civilState')].readOnly" ,hasItem (false )));
132
129
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='civilState')].titleMap[?(@.name=='Maried')].value" ,hasItem ("COMMITTED" )));
133
130
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='civilState')].titleMap[?(@.name=='Single')].value" ,hasItem ("HAPPY" )));
@@ -141,7 +138,7 @@ public void testGenerate_ComboBox() throws JsonProcessingException {
141
138
142
139
String json = new ObjectMapper ().writeValueAsString (ui );
143
140
Assert .assertThat (json , hasJsonPath ("$.schema.properties.currency.title" ,equalTo ("Currency" )));
144
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='currency')].key " ,hasSize (1 )));
141
+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='currency')]" ,hasSize (1 )));
145
142
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='currency')].disabled" ,hasItem (false )));
146
143
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='currency')].multiple" ,hasItem (false )));
147
144
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='currency')].required" ,hasItem (true )));
@@ -157,7 +154,7 @@ public void testGenerate_ComboBox_WithCustomValuesContainer() throws JsonProcess
157
154
158
155
String json = new ObjectMapper ().writeValueAsString (ui );
159
156
Assert .assertThat (json , hasJsonPath ("$.schema.properties.gender.title" ,equalTo ("Gender" )));
160
- Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='gender')].key " ,hasSize (1 )));
157
+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='gender')]" ,hasSize (1 )));
161
158
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='gender')].disabled" ,hasItem (false )));
162
159
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='gender')].multiple" ,hasItem (false )));
163
160
Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='gender')].required" ,hasItem (false )));
0 commit comments