summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java')
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java38
1 files changed, 28 insertions, 10 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java
index d841694a23..b510eeb26a 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* SDC
* ================================================================================
- * Copyright (C) 2020 Nokia Intellectual Property. All rights reserved.
+ * Copyright (C) 2020-2021 Nokia Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,30 +31,48 @@ import org.openecomp.sdc.validation.util.ValidationTestUtil;
public class PmDictionaryValidatorTest {
private static final String RESOURCE_PATH = "/org/openecomp/validation/validators/pm_dictionary_validator";
- private static final String VALID_PM_DICTIONARY_YAML = "valid_pm_dictionary.yaml";
- private static final String INVALID_PM_DICTIONARY_YAML = "invalid_pm_dictionary.yaml";
+ private static final String VALID_PM_DICTIONARY_PACKAGE_PATH = "valid_file/";
+ private static final String INVALID_PM_DICTIONARY_PACKAGE_PATH = "invalid_file/";
+ private static final String WRONG_PM_DICTIONARY_TYPE_PACKAGE_PATH = "wrong_file_type/";
+ private static final String PM_DICTIONARY_FILE_NAME = "pmdict.yaml";
+
@Test
- public void shouldNotReturnErrorsWhenValidPmDict() {
+ void shouldNotReturnErrorsWhenValidPmDict() {
+ // when
Map<String, MessageContainer> messages = runValidation(
- RESOURCE_PATH + "/" + VALID_PM_DICTIONARY_YAML);
+ RESOURCE_PATH + "/" + VALID_PM_DICTIONARY_PACKAGE_PATH);
+ // then
assertNotNull(messages);
assertEquals(0, messages.size());
}
@Test
- public void shouldReturnErrorsWhenInvalidPmDict() {
+ void shouldReturnErrorsWhenInvalidPmDict() {
+ // when
+ Map<String, MessageContainer> messages = runValidation(
+ RESOURCE_PATH + "/" + INVALID_PM_DICTIONARY_PACKAGE_PATH);
+
+ // then
+ assertNotNull(messages);
+ assertNotNull(messages.get(PM_DICTIONARY_FILE_NAME));
+ assertEquals(4, messages.get(PM_DICTIONARY_FILE_NAME).getErrorMessageList().size());
+ }
+
+ @Test
+ void shouldNotReturnErrorsWhenInvalidPmDictButWrongPmDictionaryTypeInManifest() {
+ // when
Map<String, MessageContainer> messages = runValidation(
- RESOURCE_PATH + "/" + INVALID_PM_DICTIONARY_YAML);
+ RESOURCE_PATH + "/" + WRONG_PM_DICTIONARY_TYPE_PACKAGE_PATH);
+ // then
assertNotNull(messages);
- assertNotNull(messages.get(INVALID_PM_DICTIONARY_YAML));
- assertEquals(4, messages.get(INVALID_PM_DICTIONARY_YAML).getErrorMessageList().size());
+ assertEquals(0, messages.size());
}
private Map<String, MessageContainer> runValidation(String path) {
PmDictionaryValidator validator = new PmDictionaryValidator();
return ValidationTestUtil.testValidator(validator, path);
}
-} \ No newline at end of file
+}