-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from sashirestela/8-required-constraint-should-…
…fail-for-empty-groups Required constraint should fail for empty groups
- Loading branch information
Showing
8 changed files
with
81 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Enable auto-env through the sdkman_auto_env config | ||
# Add key=value pairs of SDKs to use below | ||
java=11.0.15-tem | ||
java=11.0.22-tem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/test/java/io/github/sashirestela/slimvalidator/validators/RequiredValidatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.github.sashirestela.slimvalidator.validators; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class RequiredValidatorTest { | ||
|
||
@Test | ||
void shouldReturnExpectedResultWhenEvaluatingDataPassed() { | ||
Object[][] data = { | ||
{ null, false }, | ||
{ "", true }, | ||
{ "Text", true }, | ||
{ List.of(), false }, | ||
{ List.of(1, 2), true }, | ||
{ Map.of(), false }, | ||
{ Map.of("key", "value"), true }, | ||
{ new Object[] {}, false }, | ||
{ new Object[] { 1, 2, 3 }, true } | ||
}; | ||
for (Object[] value : data) { | ||
var validator = new RequiredValidator(); | ||
var actualResult = validator.isValid(value[0]); | ||
var expectedResult = (boolean) value[1]; | ||
assertEquals(expectedResult, actualResult); | ||
} | ||
} | ||
|
||
} |