aboutsummaryrefslogtreecommitdiffstats
path: root/certServiceClient/src
diff options
context:
space:
mode:
authorBogumil Zebek <bogumil.zebek@nokia.com>2020-03-12 06:34:09 +0000
committerGerrit Code Review <gerrit@onap.org>2020-03-12 06:34:09 +0000
commit3310d5240df5cfe07f1a9c3b312fa1d5f8f1238b (patch)
tree1e8613fa20d5da738b68c452b808738e292646d2 /certServiceClient/src
parentbfc5c800d8a93c54d44f667bcc4b4b999cf1d656 (diff)
parent3309e4acf916703538c079fe8c42858e1e952ded (diff)
Merge "Add UTs for remaining methods"
Diffstat (limited to 'certServiceClient/src')
-rw-r--r--certServiceClient/src/test/java/org/onap/aaf/certservice/client/configuration/EnvValidationUtilsTest.java36
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