Skip to content

Commit 31df9a0

Browse files
author
Saif eddine Jerbi
authored
Merge pull request #86 from imed-bh/refactoring
Move classes inside the test classes
2 parents 4145562 + 3b53bee commit 31df9a0

8 files changed

+141
-158
lines changed

src/test/java/io/asfjava/ui/core/schema/CheckBoxFormTest.java

+13-12
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,25 @@ public void testGenerate_CheckBox_WithCustomValuesContainer() throws JsonProcess
6565
Assert.assertThat(json,
6666
hasJsonPath("$.form[?(@.key=='color')].titleMap[?(@.name=='Green')].value", hasItem("green")));
6767
}
68-
}
6968

70-
class CheckBoxForm implements Serializable {
69+
private class CheckBoxForm implements Serializable {
7170

72-
@CheckBox(title = "Color", values = { "red", "blue", "green" }, defaultvalue = "red", required = true)
73-
private String color;
71+
@CheckBox(title = "Color", values = { "red", "blue", "green" }, defaultvalue = "red", required = true)
72+
private String color;
7473

75-
public String getColor() {
76-
return color;
74+
public String getColor() {
75+
return color;
76+
}
7777
}
78-
}
7978

80-
class CheckBoxForm2 implements Serializable {
79+
private class CheckBoxForm2 implements Serializable {
8180

82-
@CheckBox(title = "Color", titleMap = MyCheckBoxValues.class, defaultvalue = "red", multiple = true)
83-
private String color;
81+
@CheckBox(title = "Color", titleMap = MyCheckBoxValues.class, defaultvalue = "red", multiple = true)
82+
private String color;
8483

85-
public String getColor() {
86-
return color;
84+
public String getColor() {
85+
return color;
86+
}
8787
}
8888
}
89+

src/test/java/io/asfjava/ui/core/schema/ComboBoxFormTest.java

+14-15
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public void testGenerate_ComboBox() throws JsonProcessingException {
4949
hasJsonPath("$.form[?(@.key=='currency')].titleMap[?(@.name=='Euro')].value", hasItem("euro")));
5050
Assert.assertThat(json,
5151
hasJsonPath("$.form[?(@.key=='currency')].titleMap[?(@.name=='Dollar')].value", hasItem("dollar")));
52-
5352
}
5453

5554
@Test
@@ -67,28 +66,28 @@ public void testGenerate_ComboBox_WithCustomValuesContainer() throws JsonProcess
6766
hasJsonPath("$.form[?(@.key=='gender')].titleMap[?(@.name=='Male')].value", hasItem("male")));
6867
Assert.assertThat(json,
6968
hasJsonPath("$.form[?(@.key=='gender')].titleMap[?(@.name=='Female')].value", hasItem("female")));
70-
7169
}
7270

73-
}
74-
75-
class ComboBoxForm implements Serializable {
71+
private class ComboBoxForm implements Serializable {
7672

77-
@ComboBox(title = "Currency", values = { "euro", "dollar" }, required = true)
78-
private String currency;
73+
@ComboBox(title = "Currency", values = { "euro", "dollar" }, required = true)
74+
private String currency;
7975

80-
public String getCurrency() {
81-
return currency;
76+
public String getCurrency() {
77+
return currency;
78+
}
8279
}
83-
}
8480

85-
class ComboBoxForm2 implements Serializable {
81+
private class ComboBoxForm2 implements Serializable {
8682

87-
@ComboBox(title = "Gender", titleMap = GenderTitleMap.class)
88-
private String gender;
83+
@ComboBox(title = "Gender", titleMap = GenderTitleMap.class)
84+
private String gender;
8985

90-
public String getGender() {
91-
return gender;
86+
public String getGender() {
87+
return gender;
88+
}
9289
}
9390
}
9491

92+
93+

src/test/java/io/asfjava/ui/core/schema/NumberFormTest.java

+33-37
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public void testGenerate_Number_For_Integer() throws JsonProcessingException {
4949
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].type", hasItem("number")));
5050
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].notitle", hasItem(true)));
5151
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].readonly", hasItem(true)));
52-
5352
}
5453

5554
@Test
@@ -67,7 +66,6 @@ public void testGenerate_Number_For_Long() throws JsonProcessingException {
6766
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].type", hasItem("number")));
6867
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].notitle", hasItem(true)));
6968
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].readonly", hasItem(true)));
70-
7169
}
7270

7371

@@ -86,7 +84,6 @@ public void testGenerate_Number_For_Double() throws JsonProcessingException {
8684
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].type", hasItem("number")));
8785
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].notitle", hasItem(true)));
8886
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].readonly", hasItem(true)));
89-
9087
}
9188

9289
@Test
@@ -102,7 +99,6 @@ public void testGenerate_Number_WithRightAddon() throws JsonProcessingException
10299
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].notitle",hasItem(true)));
103100
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].readonly",hasItem(true)));
104101
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].fieldAddonRight",hasItem("@")));
105-
106102
}
107103

108104
@Test
@@ -118,56 +114,56 @@ public void testGenerate_Number_WithLeftAddon() throws JsonProcessingException {
118114
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].notitle",hasItem(true)));
119115
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].readonly",hasItem(true)));
120116
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='number')].fieldAddonLeft",hasItem("@")));
121-
122117
}
123118

124-
}
125-
126-
class IntegerNumberForm implements Serializable {
119+
private class IntegerNumberForm implements Serializable {
127120

128-
@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)
129-
private Integer number;
121+
@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)
122+
private Integer number;
130123

131-
public Integer getNumber() {
132-
return number;
124+
public Integer getNumber() {
125+
return number;
126+
}
133127
}
134-
}
135128

136-
class NumberFormRight implements Serializable {
129+
private class NumberFormRight implements Serializable {
137130

138-
@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)
139-
private Integer number;
131+
@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)
132+
private Integer number;
140133

141-
public Integer getNumber() {
142-
return number;
143-
}
144-
}
134+
public Integer getNumber() {
135+
return number;
136+
}
137+
}
145138

146-
class LongNumberForm implements Serializable {
139+
private class LongNumberForm implements Serializable {
147140

148-
@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)
149-
private Long number;
141+
@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)
142+
private Long number;
150143

151-
public Long getNumber() {
152-
return number;
144+
public Long getNumber() {
145+
return number;
146+
}
153147
}
154-
}
155148

156-
class NumberFormLeft implements Serializable {
149+
private class NumberFormLeft implements Serializable {
157150

158-
@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)
159-
private Integer number;
151+
@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)
152+
private Integer number;
160153

161-
public Integer getNumber() {
162-
return number;
154+
public Integer getNumber() {
155+
return number;
156+
}
163157
}
164-
}
165-
class DoubleNumberForm implements Serializable {
166158

167-
@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)
168-
private Double number;
159+
private class DoubleNumberForm implements Serializable {
160+
161+
@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)
162+
private Double number;
169163

170-
public Double getNumber() {
171-
return number;
164+
public Double getNumber() {
165+
return number;
166+
}
172167
}
173168
}
169+

src/test/java/io/asfjava/ui/core/schema/PasswordFormTest.java

+19-21
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ public void testGenerate_Password_WithFieldAddonLeft() throws JsonProcessingExce
6767
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='password')].notitle",hasItem(true)));
6868
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='password')].readonly",hasItem(true)));
6969
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='password')].fieldAddonLeft",hasItem("@")));
70-
7170
}
7271

7372
@Test
@@ -85,37 +84,36 @@ public void testGenerate_Password_WithFieldAddonRight() throws JsonProcessingExc
8584
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='password')].notitle",hasItem(true)));
8685
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='password')].readonly",hasItem(true)));
8786
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='password')].fieldAddonRight",hasItem("@")));
88-
8987
}
9088

91-
}
92-
93-
class PasswordForm implements Serializable {
89+
private class PasswordForm implements Serializable {
9490

95-
@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)
96-
private String password;
91+
@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)
92+
private String password;
9793

98-
public String getPassword() {
99-
return password;
94+
public String getPassword() {
95+
return password;
96+
}
10097
}
101-
}
10298

103-
class PasswordForm2 implements Serializable {
99+
private class PasswordForm2 implements Serializable {
104100

105-
@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)
106-
private String password;
101+
@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)
102+
private String password;
107103

108-
public String getPassword() {
109-
return password;
104+
public String getPassword() {
105+
return password;
106+
}
110107
}
111-
}
112108

113-
class PasswordForm3 implements Serializable {
109+
private class PasswordForm3 implements Serializable {
114110

115-
@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)
116-
private String password;
111+
@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)
112+
private String password;
117113

118-
public String getPassword() {
119-
return password;
114+
public String getPassword() {
115+
return password;
116+
}
120117
}
121118
}
119+

src/test/java/io/asfjava/ui/core/schema/RadioBoxFormTest.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,16 @@ public void testGenerate_RadioBox() throws JsonProcessingException {
4747
hasJsonPath("$.form[?(@.key=='civilState')].titleMap[?(@.name=='Single')].value", hasItem("HAPPY")));
4848
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='civilState')].titleMap[?(@.name=='Divorced')].value",
4949
hasItem("RELEASED")));
50-
5150
}
5251

53-
}
54-
55-
class RadioBoxForm implements Serializable {
52+
private class RadioBoxForm implements Serializable {
5653

57-
@RadioBox(title = "Civil State", titleMap = CivilStateValues.class)
58-
private String civilState;
54+
@RadioBox(title = "Civil State", titleMap = CivilStateValues.class)
55+
private String civilState;
5956

60-
public String getCivilState() {
61-
return civilState;
57+
public String getCivilState() {
58+
return civilState;
59+
}
6260
}
6361
}
62+

src/test/java/io/asfjava/ui/core/schema/TabbedFormTest.java

+17-18
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,22 @@ public void testGenerate_TabbedFormed() throws JsonProcessingException{
4747
Assert.assertThat(json, hasJsonPath("$.form[?(@.tabs)].tabs[?(@.title=='Contact')].items[*]",hasSize(1)));
4848
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='webSite')]"));
4949
}
50-
}
5150

52-
class TabbedForm implements Serializable{
53-
54-
@Tab(title = "Info", index = 1)
55-
@TextField(title = "First Name", placeHolder = "Your first name", description = "This is a description for your first name field")
56-
private String firstName;
57-
58-
@Tab(title = "Info", index = 1)
59-
@TextField(title = "Last Name", placeHolder = "Your last name")
60-
private String lastName;
61-
62-
@Tab(title = "Contact", index = 2)
63-
@TextField(title = "eMail", placeHolder = "Your email", pattern = "^\\S+@\\S+$", validationMessage = "Your mail must be in this format [email protected]", description = "This is Text Field with pattern and validation message")
64-
private String email;
65-
66-
@TextField(title = "Pesonal Website",fieldAddonLeft="http://", description = "This is TextField with fieldAddonLeft")
67-
private String webSite;
68-
}
51+
private class TabbedForm implements Serializable{
6952

53+
@Tab(title = "Info", index = 1)
54+
@TextField(title = "First Name", placeHolder = "Your first name", description = "This is a description for your first name field")
55+
private String firstName;
56+
57+
@Tab(title = "Info", index = 1)
58+
@TextField(title = "Last Name", placeHolder = "Your last name")
59+
private String lastName;
60+
61+
@Tab(title = "Contact", index = 2)
62+
@TextField(title = "eMail", placeHolder = "Your email", pattern = "^\\S+@\\S+$", validationMessage = "Your mail must be in this format [email protected]", description = "This is Text Field with pattern and validation message")
63+
private String email;
64+
65+
@TextField(title = "Pesonal Website",fieldAddonLeft="http://", description = "This is TextField with fieldAddonLeft")
66+
private String webSite;
67+
}
68+
}

0 commit comments

Comments
 (0)