diff options
author | pwielebs <piotr.wielebski@nokia.com> | 2020-03-11 12:42:39 +0100 |
---|---|---|
committer | pwielebs <piotr.wielebski@nokia.com> | 2020-03-11 12:52:43 +0100 |
commit | 3309e4acf916703538c079fe8c42858e1e952ded (patch) | |
tree | 1c32a8d574d7aa857b7a206890bbbc2de552c949 | |
parent | 0855846bc0ab2dcdadc5ef7ed9588f70124ce21e (diff) |
Add UTs for remaining methods
Issue-ID: AAF-996
Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Change-Id: Id2407e66d012dce2b067a9ac3eaeb424bcf58095
-rw-r--r-- | certServiceClient/src/test/java/org/onap/aaf/certservice/client/configuration/EnvValidationUtilsTest.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/certServiceClient/src/test/java/org/onap/aaf/certservice/client/configuration/EnvValidationUtilsTest.java b/certServiceClient/src/test/java/org/onap/aaf/certservice/client/configuration/EnvValidationUtilsTest.java index 8f4fe6a3..36b3b1a4 100644 --- a/certServiceClient/src/test/java/org/onap/aaf/certservice/client/configuration/EnvValidationUtilsTest.java +++ b/certServiceClient/src/test/java/org/onap/aaf/certservice/client/configuration/EnvValidationUtilsTest.java @@ -38,4 +38,40 @@ class EnvValidationUtilsTest { public void shouldRejectInvalidPath(String path){ assertFalse(EnvValidationUtils.isPathValid(path)); } + + @ParameterizedTest + @ValueSource(strings = {"PL", "DE", "PT", "US"}) + public void shouldAcceptValidCountryCode(String countryCode){ + assertTrue(EnvValidationUtils.isCountryValid(countryCode)); + } + + @ParameterizedTest + @ValueSource(strings = {"1P", "PLP", "P#", "&*"}) + public void shouldRejectInvalidCountryCode(String countryCode){ + assertFalse(EnvValidationUtils.isCountryValid(countryCode)); + } + + @ParameterizedTest + @ValueSource(strings = {"caname", "caname1", "123caName", "ca1name"}) + public void shouldAcceptValidAlphanumeric(String caName){ + assertTrue(EnvValidationUtils.isAlphaNumeric(caName)); + } + + @ParameterizedTest + @ValueSource(strings = {"44caname$", "#caname1", "1c_aname", "ca1-name"}) + public void shouldRejectInvalidAlphanumeric(String caName){ + assertFalse(EnvValidationUtils.isAlphaNumeric(caName)); + } + + @ParameterizedTest + @ValueSource(strings = {"example.com", "www.example.com"}) + public void shouldAcceptValidCommonName(String commonName){ + assertTrue(EnvValidationUtils.isCommonNameValid(commonName)); + } + + @ParameterizedTest + @ValueSource(strings = {"https://example.com", "http://example.com", "example.com:8080", "0.0.0.0", "@#$%.com"}) + public void shouldRejectInvalidCommonName(String commonName){ + assertFalse(EnvValidationUtils.isCommonNameValid(commonName)); + } }
\ No newline at end of file |