Skip to content

Commit cc5bdf3

Browse files
committed
🎨 Refactor Unit test
1 parent acb65fb commit cc5bdf3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public void testGenerate_textField() throws JsonProcessingException {
4141

4242
Assert.assertThat(json, hasJsonPath("$.schema.properties.firstName.title", equalTo("First Name")));
4343
Assert.assertThat(json, hasJsonPath("$.schema.properties.firstName.pattern", equalTo("[a-z]")));
44+
Assert.assertThat(json, hasJsonPath("$.schema.properties.firstName.minLength", equalTo(6)));
45+
Assert.assertThat(json, hasJsonPath("$.schema.properties.firstName.maxLength", equalTo(10)));
4446
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='firstName')]", hasSize(1)));
4547
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='firstName')].description",
4648
hasItem("This is a description for your first name field")));
@@ -59,6 +61,8 @@ public void testGenerate_textField_WithFieldAddonRight() throws JsonProcessingEx
5961

6062
Assert.assertThat(json, hasJsonPath("$.schema.properties.firstName.title", equalTo("First Name")));
6163
Assert.assertThat(json, hasJsonPath("$.schema.properties.firstName.pattern", equalTo("[a-z]")));
64+
Assert.assertThat(json, hasJsonPath("$.schema.properties.firstName.minLength", equalTo(6)));
65+
Assert.assertThat(json, hasJsonPath("$.schema.properties.firstName.maxLength", equalTo(10)));
6266
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='firstName')]", hasSize(1)));
6367
Assert.assertThat(json, hasJsonPath("$.form[?(@.key=='firstName')].description",
6468
hasItem("This is a description for your first name field")));
@@ -90,7 +94,7 @@ public void testGenerate_textField_WithFieldAddonLeft() throws JsonProcessingExc
9094

9195
class TextFieldForm implements Serializable {
9296

93-
@TextField(title = "First Name", placeHolder = "Your first name", pattern = "[a-z]", noTitle = true, validationMessage = "this is a validation msg", description = "This is a description for your first name field", readOnly = true)
97+
@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)
9498
private String firstName;
9599

96100
public String getFirstName() {
@@ -101,7 +105,7 @@ public String getFirstName() {
101105

102106
class TextFieldFormRight implements Serializable {
103107

104-
@TextField(title = "First Name", placeHolder = "Your first name", fieldAddonRight = "@", pattern = "[a-z]", noTitle = true, validationMessage = "this is a validation msg", description = "This is a description for your first name field")
108+
@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")
105109
private String firstName;
106110

107111
public String getFirstName() {
@@ -120,3 +124,5 @@ public String getFirstName() {
120124
}
121125

122126
}
127+
128+

0 commit comments

Comments
 (0)