Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions src/test/java/io/asfjava/ui/core/schema/CheckBoxFormTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

29 changes: 14 additions & 15 deletions src/test/java/io/asfjava/ui/core/schema/ComboBoxFormTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
}
}



70 changes: 33 additions & 37 deletions src/test/java/io/asfjava/ui/core/schema/NumberFormTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)));

}


Expand All @@ -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
Expand All @@ -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
Expand All @@ -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;
}
}
}

40 changes: 19 additions & 21 deletions src/test/java/io/asfjava/ui/core/schema/PasswordFormTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
}
}

15 changes: 7 additions & 8 deletions src/test/java/io/asfjava/ui/core/schema/RadioBoxFormTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

35 changes: 17 additions & 18 deletions src/test/java/io/asfjava/ui/core/schema/TabbedFormTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Loading