diff --git a/src/test/java/io/asfjava/ui/core/schema/CheckBoxFormTest.java b/src/test/java/io/asfjava/ui/core/schema/CheckBoxFormTest.java index 063cdef..f775e62 100644 --- a/src/test/java/io/asfjava/ui/core/schema/CheckBoxFormTest.java +++ b/src/test/java/io/asfjava/ui/core/schema/CheckBoxFormTest.java @@ -65,24 +65,25 @@ public void testGenerate_CheckBox_WithCustomValuesContainer() throws JsonProcess Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='color')].titleMap[?(@.name=='Green')].value", hasItem("green"))); } -} -class CheckBoxForm implements Serializable { + private class CheckBoxForm implements Serializable { - @CheckBox(title = "Color", values = { "red", "blue", "green" }, defaultvalue = "red", required = true) - private String color; + @CheckBox(title = "Color", values = { "red", "blue", "green" }, defaultvalue = "red", required = true) + private String color; - public String getColor() { - return color; + public String getColor() { + return color; + } } -} -class CheckBoxForm2 implements Serializable { + private class CheckBoxForm2 implements Serializable { - @CheckBox(title = "Color", titleMap = MyCheckBoxValues.class, defaultvalue = "red", multiple = true) - private String color; + @CheckBox(title = "Color", titleMap = MyCheckBoxValues.class, defaultvalue = "red", multiple = true) + private String color; - public String getColor() { - return color; + public String getColor() { + return color; + } } } + diff --git a/src/test/java/io/asfjava/ui/core/schema/ComboBoxFormTest.java b/src/test/java/io/asfjava/ui/core/schema/ComboBoxFormTest.java index 14d04da..8095da0 100644 --- a/src/test/java/io/asfjava/ui/core/schema/ComboBoxFormTest.java +++ b/src/test/java/io/asfjava/ui/core/schema/ComboBoxFormTest.java @@ -49,7 +49,6 @@ public void testGenerate_ComboBox() throws JsonProcessingException { hasJsonPath("$.form[?(@.key=='currency')].titleMap[?(@.name=='Euro')].value", hasItem("euro"))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='currency')].titleMap[?(@.name=='Dollar')].value", hasItem("dollar"))); - } @Test @@ -67,28 +66,28 @@ public void testGenerate_ComboBox_WithCustomValuesContainer() throws JsonProcess hasJsonPath("$.form[?(@.key=='gender')].titleMap[?(@.name=='Male')].value", hasItem("male"))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='gender')].titleMap[?(@.name=='Female')].value", hasItem("female"))); - } -} - -class ComboBoxForm implements Serializable { + private class ComboBoxForm implements Serializable { - @ComboBox(title = "Currency", values = { "euro", "dollar" }, required = true) - private String currency; + @ComboBox(title = "Currency", values = { "euro", "dollar" }, required = true) + private String currency; - public String getCurrency() { - return currency; + public String getCurrency() { + return currency; + } } -} -class ComboBoxForm2 implements Serializable { + private class ComboBoxForm2 implements Serializable { - @ComboBox(title = "Gender", titleMap = GenderTitleMap.class) - private String gender; + @ComboBox(title = "Gender", titleMap = GenderTitleMap.class) + private String gender; - public String getGender() { - return gender; + public String getGender() { + return gender; + } } } + + diff --git a/src/test/java/io/asfjava/ui/core/schema/NumberFormTest.java b/src/test/java/io/asfjava/ui/core/schema/NumberFormTest.java index a6f5931..1075ae8 100644 --- a/src/test/java/io/asfjava/ui/core/schema/NumberFormTest.java +++ b/src/test/java/io/asfjava/ui/core/schema/NumberFormTest.java @@ -49,7 +49,6 @@ public void testGenerate_Number_For_Integer() throws JsonProcessingException { Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].type", hasItem("number"))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].notitle", hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].readonly", hasItem(true))); - } @Test @@ -67,7 +66,6 @@ public void testGenerate_Number_For_Long() throws JsonProcessingException { Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].type", hasItem("number"))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].notitle", hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].readonly", hasItem(true))); - } @@ -86,7 +84,6 @@ public void testGenerate_Number_For_Double() throws JsonProcessingException { Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].type", hasItem("number"))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].notitle", hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].readonly", hasItem(true))); - } @Test @@ -102,7 +99,6 @@ public void testGenerate_Number_WithRightAddon() throws JsonProcessingException Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].notitle",hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].readonly",hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].fieldAddonRight",hasItem("@"))); - } @Test @@ -118,56 +114,56 @@ public void testGenerate_Number_WithLeftAddon() throws JsonProcessingException { Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].notitle",hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].readonly",hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].fieldAddonLeft",hasItem("@"))); - } -} - -class IntegerNumberForm implements Serializable { + private class IntegerNumberForm implements Serializable { - @Number(title = "Integer Number", placeHolder = "Integer Number PlaceHolder", description = "This is an integer number", noTitle = true, validationMessage = "this is a validation msg for an integer value", readOnly = true) - private Integer number; + @Number(title = "Integer Number", placeHolder = "Integer Number PlaceHolder", description = "This is an integer number", noTitle = true, validationMessage = "this is a validation msg for an integer value", readOnly = true) + private Integer number; - public Integer getNumber() { - return number; + public Integer getNumber() { + return number; + } } -} -class NumberFormRight implements Serializable { + private class NumberFormRight implements Serializable { - @Number(title = "Number of children", placeHolder = "Number of children", fieldAddonRight = "@", description = "This is a number", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) - private Integer number; + @Number(title = "Number of children", placeHolder = "Number of children", fieldAddonRight = "@", description = "This is a number", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) + private Integer number; - public Integer getNumber() { - return number; - } -} + public Integer getNumber() { + return number; + } + } -class LongNumberForm implements Serializable { + private class LongNumberForm implements Serializable { - @Number(title = "Long Number", placeHolder = "Long Number PlaceHolder", description = "This is a long number", noTitle = true, validationMessage = "this is a validation msg for long value", readOnly = true) - private Long number; + @Number(title = "Long Number", placeHolder = "Long Number PlaceHolder", description = "This is a long number", noTitle = true, validationMessage = "this is a validation msg for long value", readOnly = true) + private Long number; - public Long getNumber() { - return number; + public Long getNumber() { + return number; + } } -} -class NumberFormLeft implements Serializable { + private class NumberFormLeft implements Serializable { - @Number(title = "Number of children", placeHolder = "Number of children", fieldAddonLeft = "@", description = "This is a number", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) - private Integer number; + @Number(title = "Number of children", placeHolder = "Number of children", fieldAddonLeft = "@", description = "This is a number", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) + private Integer number; - public Integer getNumber() { - return number; + public Integer getNumber() { + return number; + } } -} -class DoubleNumberForm implements Serializable { - @Number(title = "Double Number", placeHolder = "Double Number PlaceHolder", description = "This is a double number", noTitle = true, validationMessage = "this is a validation msg for double value", readOnly = true) - private Double number; + private class DoubleNumberForm implements Serializable { + + @Number(title = "Double Number", placeHolder = "Double Number PlaceHolder", description = "This is a double number", noTitle = true, validationMessage = "this is a validation msg for double value", readOnly = true) + private Double number; - public Double getNumber() { - return number; + public Double getNumber() { + return number; + } } } + diff --git a/src/test/java/io/asfjava/ui/core/schema/PasswordFormTest.java b/src/test/java/io/asfjava/ui/core/schema/PasswordFormTest.java index 296d940..cd15a8e 100644 --- a/src/test/java/io/asfjava/ui/core/schema/PasswordFormTest.java +++ b/src/test/java/io/asfjava/ui/core/schema/PasswordFormTest.java @@ -67,7 +67,6 @@ public void testGenerate_Password_WithFieldAddonLeft() throws JsonProcessingExce Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='password')].notitle",hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='password')].readonly",hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='password')].fieldAddonLeft",hasItem("@"))); - } @Test @@ -85,37 +84,36 @@ public void testGenerate_Password_WithFieldAddonRight() throws JsonProcessingExc Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='password')].notitle",hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='password')].readonly",hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='password')].fieldAddonRight",hasItem("@"))); - } -} - -class PasswordForm implements Serializable { + private class PasswordForm implements Serializable { - @Password(title = "Password", placeHolder = "Please set you password", pattern = "[a-z]", description = "This is password", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) - private String password; + @Password(title = "Password", placeHolder = "Please set you password", pattern = "[a-z]", description = "This is password", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) + private String password; - public String getPassword() { - return password; + public String getPassword() { + return password; + } } -} -class PasswordForm2 implements Serializable { + private class PasswordForm2 implements Serializable { - @Password(title = "Password", placeHolder = "Please set you password", pattern = "[a-z]",minLenght=6,maxLenght=10, fieldAddonRight = "@", description = "This is password", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) - private String password; + @Password(title = "Password", placeHolder = "Please set you password", pattern = "[a-z]",minLenght=6,maxLenght=10, fieldAddonRight = "@", description = "This is password", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) + private String password; - public String getPassword() { - return password; + public String getPassword() { + return password; + } } -} -class PasswordForm3 implements Serializable { + private class PasswordForm3 implements Serializable { - @Password(title = "Password", placeHolder = "Please set you password", pattern = "[a-z]",minLenght=6,maxLenght=10, fieldAddonLeft = "@", description = "This is password", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) - private String password; + @Password(title = "Password", placeHolder = "Please set you password", pattern = "[a-z]",minLenght=6,maxLenght=10, fieldAddonLeft = "@", description = "This is password", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) + private String password; - public String getPassword() { - return password; + public String getPassword() { + return password; + } } } + diff --git a/src/test/java/io/asfjava/ui/core/schema/RadioBoxFormTest.java b/src/test/java/io/asfjava/ui/core/schema/RadioBoxFormTest.java index 7a0bb47..57267b0 100644 --- a/src/test/java/io/asfjava/ui/core/schema/RadioBoxFormTest.java +++ b/src/test/java/io/asfjava/ui/core/schema/RadioBoxFormTest.java @@ -47,17 +47,16 @@ public void testGenerate_RadioBox() throws JsonProcessingException { hasJsonPath("$.form[?(@.key=='civilState')].titleMap[?(@.name=='Single')].value", hasItem("HAPPY"))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='civilState')].titleMap[?(@.name=='Divorced')].value", hasItem("RELEASED"))); - } -} - -class RadioBoxForm implements Serializable { + private class RadioBoxForm implements Serializable { - @RadioBox(title = "Civil State", titleMap = CivilStateValues.class) - private String civilState; + @RadioBox(title = "Civil State", titleMap = CivilStateValues.class) + private String civilState; - public String getCivilState() { - return civilState; + public String getCivilState() { + return civilState; + } } } + diff --git a/src/test/java/io/asfjava/ui/core/schema/TabbedFormTest.java b/src/test/java/io/asfjava/ui/core/schema/TabbedFormTest.java index 6cd0588..85f4ab1 100644 --- a/src/test/java/io/asfjava/ui/core/schema/TabbedFormTest.java +++ b/src/test/java/io/asfjava/ui/core/schema/TabbedFormTest.java @@ -47,23 +47,22 @@ public void testGenerate_TabbedFormed() throws JsonProcessingException{ Assert.assertThat(json, hasJsonPath("$.form[?(@.tabs)].tabs[?(@.title=='Contact')].items[*]",hasSize(1))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='webSite')]")); } -} -class TabbedForm implements Serializable{ - - @Tab(title = "Info", index = 1) - @TextField(title = "First Name", placeHolder = "Your first name", description = "This is a description for your first name field") - private String firstName; - - @Tab(title = "Info", index = 1) - @TextField(title = "Last Name", placeHolder = "Your last name") - private String lastName; - - @Tab(title = "Contact", index = 2) - @TextField(title = "eMail", placeHolder = "Your email", pattern = "^\\S+@\\S+$", validationMessage = "Your mail must be in this format jhondoe@example.com", description = "This is Text Field with pattern and validation message") - private String email; - - @TextField(title = "Pesonal Website",fieldAddonLeft="http://", description = "This is TextField with fieldAddonLeft") - private String webSite; -} + private class TabbedForm implements Serializable{ + @Tab(title = "Info", index = 1) + @TextField(title = "First Name", placeHolder = "Your first name", description = "This is a description for your first name field") + private String firstName; + + @Tab(title = "Info", index = 1) + @TextField(title = "Last Name", placeHolder = "Your last name") + private String lastName; + + @Tab(title = "Contact", index = 2) + @TextField(title = "eMail", placeHolder = "Your email", pattern = "^\\S+@\\S+$", validationMessage = "Your mail must be in this format jhondoe@example.com", description = "This is Text Field with pattern and validation message") + private String email; + + @TextField(title = "Pesonal Website",fieldAddonLeft="http://", description = "This is TextField with fieldAddonLeft") + private String webSite; + } +} diff --git a/src/test/java/io/asfjava/ui/core/schema/TextAreaFormTest.java b/src/test/java/io/asfjava/ui/core/schema/TextAreaFormTest.java index f4cfd59..a71ae75 100644 --- a/src/test/java/io/asfjava/ui/core/schema/TextAreaFormTest.java +++ b/src/test/java/io/asfjava/ui/core/schema/TextAreaFormTest.java @@ -50,7 +50,6 @@ public void testGenerate_TextArea() throws JsonProcessingException { // hasJsonPath("$.form[?(@.key=='password')].type",hasItem("textArea"))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='address')].notitle", hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='address')].readonly", hasItem(true))); - } public void testGenerate_TextArea_WithFieldAddOnLeft() throws JsonProcessingException { @@ -71,8 +70,6 @@ public void testGenerate_TextArea_WithFieldAddOnLeft() throws JsonProcessingExce Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='address')].notitle", hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='address')].readonly", hasItem(true))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='address')].fieldAddonLeft", hasItem("@"))); - - } public void testGenerate_TextArea_WithFieldAddOnRight() throws JsonProcessingException { @@ -93,34 +90,34 @@ public void testGenerate_TextArea_WithFieldAddOnRight() throws JsonProcessingExc Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='address')].fieldAddonRight", hasItem("@"))); } -} - -class TextAreaForm2 implements Serializable { + private class TextAreaForm2 implements Serializable { - @TextArea(title = "Address", placeHolder = "Fill your address please", fieldAddonLeft = "@",minLenght=6,maxLenght=10, description = "This is textarea", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) - private String address; + @TextArea(title = "Address", placeHolder = "Fill your address please", fieldAddonLeft = "@",minLenght=6,maxLenght=10, description = "This is textarea", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) + private String address; - public String getAddress() { - return address; + public String getAddress() { + return address; + } } -} -class TextAreaForm3 implements Serializable { + private class TextAreaForm3 implements Serializable { - @TextArea(title = "Address", placeHolder = "Fill your address please",fieldAddonRight = "@",minLenght=6,maxLenght=10, description = "This is textarea", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) - private String address; + @TextArea(title = "Address", placeHolder = "Fill your address please",fieldAddonRight = "@",minLenght=6,maxLenght=10, description = "This is textarea", noTitle = true, validationMessage = "this is a validation msg", readOnly = true) + private String address; - public String getAddress() { - return address; + public String getAddress() { + return address; + } } -} -class TextAreaForm implements Serializable { + private class TextAreaForm implements Serializable { - @TextArea(title = "Address", placeHolder = "Fill your address please", description = "This is textarea",minLenght=6,maxLenght=10, noTitle = true, validationMessage = "this is a validation msg", readOnly = true) - private String address; + @TextArea(title = "Address", placeHolder = "Fill your address please", description = "This is textarea",minLenght=6,maxLenght=10, noTitle = true, validationMessage = "this is a validation msg", readOnly = true) + private String address; - public String getAddress() { - return address; + public String getAddress() { + return address; + } } } + diff --git a/src/test/java/io/asfjava/ui/core/schema/TextFieldFormTest.java b/src/test/java/io/asfjava/ui/core/schema/TextFieldFormTest.java index 8763a83..6e5c5eb 100644 --- a/src/test/java/io/asfjava/ui/core/schema/TextFieldFormTest.java +++ b/src/test/java/io/asfjava/ui/core/schema/TextFieldFormTest.java @@ -51,7 +51,6 @@ public void testGenerate_textField() throws JsonProcessingException { hasJsonPath("$.form[?(@.key=='firstName')].validationMessage", hasItem("this is a validation msg"))); // Assert.assertThat(json, // hasJsonPath("$.form[?(@.key=='firstName')].type",hasItem("textField"))); - } @Test @@ -70,7 +69,6 @@ public void testGenerate_textField_WithFieldAddonRight() throws JsonProcessingEx Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='firstName')].validationMessage", hasItem("this is a validation msg"))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='firstName')].fieldAddonRight", hasItem("@"))); - } @Test @@ -87,42 +85,38 @@ public void testGenerate_textField_WithFieldAddonLeft() throws JsonProcessingExc Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='firstName')].validationMessage", hasItem("this is a validation msg"))); Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='firstName')].fieldAddonLeft", hasItem("@"))); - } -} - -class TextFieldForm implements Serializable { + private class TextFieldForm implements Serializable { - @TextField(title = "First Name", placeHolder = "Your first name", pattern = "[a-z]",minLenght=6,maxLenght=10, noTitle = true, validationMessage = "this is a validation msg", description = "This is a description for your first name field", readOnly = true) - private String firstName; + @TextField(title = "First Name", placeHolder = "Your first name", pattern = "[a-z]",minLenght=6,maxLenght=10, noTitle = true, validationMessage = "this is a validation msg", description = "This is a description for your first name field", readOnly = true) + private String firstName; - public String getFirstName() { - return firstName; + public String getFirstName() { + return firstName; + } } -} + private class TextFieldFormRight implements Serializable { -class TextFieldFormRight implements Serializable { + @TextField(title = "First Name", placeHolder = "Your first name", fieldAddonRight = "@", pattern = "[a-z]",minLenght=6,maxLenght=10, noTitle = true, validationMessage = "this is a validation msg", description = "This is a description for your first name field") + private String firstName; - @TextField(title = "First Name", placeHolder = "Your first name", fieldAddonRight = "@", pattern = "[a-z]",minLenght=6,maxLenght=10, noTitle = true, validationMessage = "this is a validation msg", description = "This is a description for your first name field") - private String firstName; - - public String getFirstName() { - return firstName; + public String getFirstName() { + return firstName; + } } -} - -class TextFieldFormLeft implements Serializable { + private class TextFieldFormLeft implements Serializable { - @TextField(title = "First Name", placeHolder = "Your first name", fieldAddonLeft = "@", pattern = "[a-z]", noTitle = true, validationMessage = "this is a validation msg", description = "This is a description for your first name field") - private String firstName; + @TextField(title = "First Name", placeHolder = "Your first name", fieldAddonLeft = "@", pattern = "[a-z]", noTitle = true, validationMessage = "this is a validation msg", description = "This is a description for your first name field") + private String firstName; - public String getFirstName() { - return firstName; + public String getFirstName() { + return firstName; + } } - } +