Skip to content

Commit 08196c4

Browse files
committed
JUnit for optional / required ValidatorRegex
1 parent 8e03a1f commit 08196c4

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

fj-core/src/test/java/test/org/fugerit/java/core/validator/TestValidatorCatalog.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public void testRegexValidator001( Locale l ) {
5353
this.validatorWorker( "testRegexValidator" , result, l, "test value one", "test label 1 (valid)", true, params);
5454
this.validatorWorker( "testRegexValidatorExt" , result, l, "test value one", "test label 1 (not valid)", false, params);
5555
this.validatorWorker( "testRegexValidatorExt" , result, l, "t", "t (not valid)", false, params);
56+
this.validatorWorker( "testRegexValidatorExt" , result, l, "", "blank (required)", false, params);
57+
this.validatorWorker( "testRegexValidatorExtOptional" , result, l, "", "blank (optional)", true, params);
5658
this.validatorWorker( "testRegexValidator" , result, l, "test value 2 <>", "test label 2 (not valid)", false, params);
5759
this.validatorWorker( "testDateValidator" , result, l, "01/03/2020", "Valid date", true, params);
5860
this.validatorWorker( "testDateValidator" , result, l, "01/03-202A", "Invalid date 1", false, params);

fj-core/src/test/resources/core/validator/validator-catalog-test.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,11 @@
3535
<entry key="maximumIntegerDigits">10</entry>
3636
<entry key="maximumFractionDigits">3</entry>
3737
</validator>
38+
39+
<validator id="testRegexValidatorExtOptional" parent="testRegexValidator"
40+
type="org.fugerit.java.core.validator.ValidatorRegex">
41+
<entry key="required">false</entry>
42+
<entry key="maxLength">5</entry>
43+
</validator>
3844

3945
</validator-catalog>

0 commit comments

Comments
 (0)