@@ -246,6 +246,46 @@ public void testGenerate_TextArea() throws JsonProcessingException {
246246 Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].notitle" , hasItem (true )));
247247 Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].readonly" , hasItem (true )));
248248
249+ }
250+
251+ public void testGenerate_TextArea_WithFieldAddOnLeft () throws JsonProcessingException {
252+ UiForm ui = UiFormSchemaGenerator .get ().generate (TextAreaForm2 .class );
253+
254+ String json = new ObjectMapper ().writeValueAsString (ui );
255+ Assert .assertThat (json , hasJsonPath ("$.schema.properties.address.title" , equalTo ("Address" )));
256+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')]" , hasSize (1 )));
257+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].description" , hasItem ("This is textarea" )));
258+ Assert .assertThat (json ,
259+ hasJsonPath ("$.form[?(@.key=='address')].placeholder" , hasItem ("Fill your address please" )));
260+ Assert .assertThat (json ,
261+ hasJsonPath ("$.form[?(@.key=='address')].validationMessage" , hasItem ("this is a validation msg" )));
262+ // Assert.assertThat(json,
263+ // hasJsonPath("$.form[?(@.key=='password')].type",hasItem("textArea")));
264+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].notitle" , hasItem (true )));
265+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].readonly" , hasItem (true )));
266+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].fieldAddonLeft" , hasItem ("@" )));
267+
268+
269+ }
270+
271+ public void testGenerate_TextArea_WithFieldAddOnRight () throws JsonProcessingException {
272+ UiForm ui = UiFormSchemaGenerator .get ().generate (TextAreaForm3 .class );
273+
274+ String json = new ObjectMapper ().writeValueAsString (ui );
275+ Assert .assertThat (json , hasJsonPath ("$.schema.properties.address.title" , equalTo ("Address" )));
276+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')]" , hasSize (1 )));
277+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].description" , hasItem ("This is textarea" )));
278+ Assert .assertThat (json ,
279+ hasJsonPath ("$.form[?(@.key=='address')].placeholder" , hasItem ("Fill your address please" )));
280+ Assert .assertThat (json ,
281+ hasJsonPath ("$.form[?(@.key=='address')].validationMessage" , hasItem ("this is a validation msg" )));
282+ // Assert.assertThat(json,
283+ // hasJsonPath("$.form[?(@.key=='password')].type",hasItem("textArea")));
284+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].notitle" , hasItem (true )));
285+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].readonly" , hasItem (true )));
286+ Assert .assertThat (json , hasJsonPath ("$.form[?(@.key=='address')].fieldAddonRight" , hasItem ("@" )));
287+
288+
249289 }
250290
251291 @ Test
@@ -446,6 +486,26 @@ public String getPassword() {
446486 }
447487}
448488
489+ class TextAreaForm2 implements Serializable {
490+
491+ @ TextArea (title = "Address" , placeHolder = "Fill your address please" , fieldAddonLeft = "@" , description = "This is textarea" , noTitle = true , validationMessage = "this is a validation msg" , readOnly = true )
492+ private String address ;
493+
494+ public String getAddress () {
495+ return address ;
496+ }
497+ }
498+
499+ class TextAreaForm3 implements Serializable {
500+
501+ @ TextArea (title = "Address" , placeHolder = "Fill your address please" ,fieldAddonRight = "@" , description = "This is textarea" , noTitle = true , validationMessage = "this is a validation msg" , readOnly = true )
502+ private String address ;
503+
504+ public String getAddress () {
505+ return address ;
506+ }
507+ }
508+
449509class TextAreaForm implements Serializable {
450510
451511 @ TextArea (title = "Address" , placeHolder = "Fill your address please" , description = "This is textarea" , noTitle = true , validationMessage = "this is a validation msg" , readOnly = true )
0 commit comments