summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-common-lib/src
diff options
context:
space:
mode:
authorSatyaki Mallick <satyaki.mallick@huawei.com>2018-10-21 19:19:42 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-11-12 10:42:35 +0000
commit01c427f1a30ecbcee63fabbee4bc0877a9aec53b (patch)
treebc0b3ca25f20a9c11a5d2f612e767886295ed7ad /openecomp-be/lib/openecomp-common-lib/src
parentfbd23ad8f6c29c8f1c24eca5e03c47995b89a5ea (diff)
Add UT for CommonUtil
Add UT for CommonUtil in openecomp-be. Issue-ID: SDC-1774 Change-Id: Id197e79ede009f3ca34043f907a48b26af17be53 Signed-off-by: Satyaki Mallick <satyaki.mallick@huawei.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-common-lib/src')
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java12
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java38
2 files changed, 42 insertions, 8 deletions
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java
index a7b17b7fe9..7d37a55388 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java
@@ -1,9 +1,6 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
+/*
* Copyright (C) 2017 AT&T 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.
* You may obtain a copy of the License at
@@ -15,7 +12,6 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.common.utils;
@@ -53,8 +49,8 @@ import java.util.zip.ZipException;
import java.util.zip.ZipInputStream;
public class CommonUtil {
- private static final String DEFAULT = "default";
- private static final String _DEFAULT = "_default";
+ static final String DEFAULT = "default";
+ static final String _DEFAULT = "_default";
private CommonUtil() {
// prevent instantiation
diff --git a/openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java b/openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java
new file mode 100644
index 0000000000..d421043c80
--- /dev/null
+++ b/openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2017 Huawei 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.common.utils;
+
+import org.testng.annotations.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.testng.Assert.assertTrue;
+
+public class CommonUtilTest {
+
+ @Test
+ public void testGetObjectAsMap() {
+ Map<String, String> obj = new HashMap<>(1);
+ obj.put(CommonUtil.DEFAULT, "");
+ Map<String, Object> newMap = CommonUtil.getObjectAsMap(obj);
+
+ boolean exists = newMap.containsKey(CommonUtil._DEFAULT);
+
+ assertTrue(exists);
+ }
+} \ No newline at end of file