summaryrefslogtreecommitdiffstats
path: root/common/onap-common-configuration-management/onap-configuration-management-core/src/test
diff options
context:
space:
mode:
authorDmitry Puzikov <d.puzikov2@partner.samsung.com>2019-11-28 09:24:00 +0100
committerOfir Sonsino <ofir.sonsino@intl.att.com>2019-12-15 16:04:07 +0000
commit8acb01dfb8a8fb2f6f77f154382933283b269566 (patch)
tree4052e145356a401efe1f3fb1ce94433b68eff9cb /common/onap-common-configuration-management/onap-configuration-management-core/src/test
parenta941f3fa78dc1c19ef895e164037cfd6ee98f7ae (diff)
Fix unprocessed NPE
Process NPE safe way. Add no NPE failures tests. Add caught exceptions logging. Issue-ID: SDC-2694 Signed-off-by: Dmitry Puzikov <d.puzikov2@partner.samsung.com> Change-Id: Ic1d6e7f9b4f210ac0ca289dc6f44d7c6e15ef126
Diffstat (limited to 'common/onap-common-configuration-management/onap-configuration-management-core/src/test')
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/CliConfigurationImpTest.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/CliConfigurationImpTest.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/CliConfigurationImpTest.java
index 3d12eac13d..897583f605 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/CliConfigurationImpTest.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/test/java/org/onap/config/CliConfigurationImpTest.java
@@ -19,8 +19,10 @@ package org.onap.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.util.HashMap;
import java.util.Map;
+import org.junit.Assert;
import org.junit.Test;
import org.onap.config.api.ConfigurationManager;
import org.onap.config.impl.CliConfigurationImpl;
@@ -51,6 +53,30 @@ public class CliConfigurationImpTest {
assertEquals("org.junit.Test", testServiceImpl.getImplementationClass());
}
+ @Test
+ public void listConfigurationNullQueryShouldntFailWithNPETest() {
+ ConfigurationManager conf = new CliConfigurationImpl();
+ Assert.assertEquals(0, conf.listConfiguration(null).size());
+ }
+
+ @Test
+ public void listConfigurationEmptyQueryTest() {
+ ConfigurationManager conf = new CliConfigurationImpl();
+ Assert.assertEquals(0, conf.listConfiguration(new HashMap<>()).size());
+ }
+
+ @Test
+ public void getConfigurationValueNullQueryShouldntFailWithNPETest() {
+ ConfigurationManager conf = new CliConfigurationImpl();
+ Assert.assertNull (conf.getConfigurationValue(null));
+ }
+
+ @Test
+ public void getConfigurationValueEmptyQueryTest() {
+ ConfigurationManager conf = new CliConfigurationImpl();
+ Assert.assertNull (conf.getConfigurationValue(new HashMap<>()));
+ }
+
private void validateCliMapConfig(Map outputMap) {
assertEquals("appc",
outputMap.get(withoutArtifactPrefix(ConfigTestConstant.ARTIFACT_CONSUMER)));