diff options
author | Thomas <> | 2023-06-27 09:29:56 +0200 |
---|---|---|
committer | Thomas <> | 2023-06-27 09:29:56 +0200 |
commit | 234176b7fe5c4178449d74a9627c3645212ac821 (patch) | |
tree | d24b9e25c8d96f15fcc5ec2f9b991d3e7ed13701 /pdf-as-common/src/test/java/at/gv/egiz/pdfas/common | |
parent | ca7b9d0863dcc1c02849a23db66310146f91c104 (diff) | |
download | pdf-as-4-234176b7fe5c4178449d74a9627c3645212ac821.tar.gz pdf-as-4-234176b7fe5c4178449d74a9627c3645212ac821.tar.bz2 pdf-as-4-234176b7fe5c4178449d74a9627c3645212ac821.zip |
test(core): actived and fix some more tests
Diffstat (limited to 'pdf-as-common/src/test/java/at/gv/egiz/pdfas/common')
-rw-r--r-- | pdf-as-common/src/test/java/at/gv/egiz/pdfas/common/test/utils/CheckSignatureParametersTest.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/pdf-as-common/src/test/java/at/gv/egiz/pdfas/common/test/utils/CheckSignatureParametersTest.java b/pdf-as-common/src/test/java/at/gv/egiz/pdfas/common/test/utils/CheckSignatureParametersTest.java new file mode 100644 index 00000000..5ec0541b --- /dev/null +++ b/pdf-as-common/src/test/java/at/gv/egiz/pdfas/common/test/utils/CheckSignatureParametersTest.java @@ -0,0 +1,48 @@ +package at.gv.egiz.pdfas.common.test.utils; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.BlockJUnit4ClassRunner; + +import at.gv.egiz.pdfas.common.settings.DefaultSignatureProfileSettings; +import at.gv.egiz.pdfas.common.utils.CheckSignatureBlockParameters; + +@RunWith(BlockJUnit4ClassRunner.class) +public class CheckSignatureParametersTest { + + @Test + public void singleTest() { + assertTrue("valid characters are not possilbe", + CheckSignatureBlockParameters.isValid("Güssing", + DefaultSignatureProfileSettings.SIG_BLOCK_PARAMETER_DEFAULT_VALUE_REGEX)); + + } + + @Test + public void specialCharactersCompiletimeConfig() { + Map<String, String> toTest = new HashMap<>(); + toTest.put("test", "Güssing"); + + assertTrue("valid characters are not possilbe", + CheckSignatureBlockParameters.checkSignatureBlockParameterMapIsValid(toTest , null, null)); + + } + + @Test + public void specialCharactersExampleConfig() { + Map<String, String> toTest = new HashMap<>(); + toTest.put("test", "Güssing"); + + assertFalse("valid characters are not possilbe", + CheckSignatureBlockParameters.checkSignatureBlockParameterMapIsValid(toTest , + "^([A-za-z]){1,20}$", "^([\\p{Print}]){1,100}$")); + + } + +} |