diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2021-09-02 14:08:28 +0200 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2021-09-02 14:08:28 +0200 |
commit | 77b735d531aa880671c35a1ed3d2d56312742644 (patch) | |
tree | 6d1ddfad12be5cc94224d2073e242af2905fe8eb /src/test/java | |
parent | 2053da3c7247ff4f23a7adacd55af1566038a8d3 (diff) | |
parent | 8390095d1f7d25cf0a78709d3de6b77b72ea41bc (diff) | |
download | egovutils-77b735d531aa880671c35a1ed3d2d56312742644.tar.gz egovutils-77b735d531aa880671c35a1ed3d2d56312742644.tar.bz2 egovutils-77b735d531aa880671c35a1ed3d2d56312742644.zip |
Merge branch 'nightlyBuild' of gitlab.iaik.tugraz.at:egiz/egovutils into nightlyBuild
Diffstat (limited to 'src/test/java')
-rw-r--r-- | src/test/java/at/gv/util/test/ValitationUtilsTest.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/java/at/gv/util/test/ValitationUtilsTest.java b/src/test/java/at/gv/util/test/ValitationUtilsTest.java new file mode 100644 index 0000000..e4e5b3f --- /dev/null +++ b/src/test/java/at/gv/util/test/ValitationUtilsTest.java @@ -0,0 +1,36 @@ +package at.gv.util.test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.apache.commons.lang.RandomStringUtils; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.BlockJUnit4ClassRunner; + +import at.gv.util.ValidationUtils; + +@RunWith(BlockJUnit4ClassRunner.class) +public class ValitationUtilsTest { + + @Test + public void dateOfBirthFormat() { + assertFalse("wrong format not detected", ValidationUtils.isDateFormat("19-06-2002")); + assertFalse("wrong format not detected", ValidationUtils.isOverThirteen(RandomStringUtils.randomAlphanumeric(10))); + + assertTrue("detected", ValidationUtils.isDateFormat("19.06.2002")); + + } + + @Test + public void ageVerification() { + assertTrue("not over 14", ValidationUtils.isOverThirteen("01.01.1985")); + assertTrue("not over 14", ValidationUtils.isOverThirteen("17.06.2007")); + assertTrue("not over 14", ValidationUtils.isOverThirteen("18.06.2007")); + assertFalse("not over 14", ValidationUtils.isOverThirteen("19.06.2015")); + + assertFalse("not over 14", ValidationUtils.isOverThirteen("19-06-2002")); + assertFalse("not over 14", ValidationUtils.isOverThirteen(RandomStringUtils.randomAlphanumeric(10))); + + } +} |