From 01c427f1a30ecbcee63fabbee4bc0877a9aec53b Mon Sep 17 00:00:00 2001 From: Satyaki Mallick Date: Sun, 21 Oct 2018 19:19:42 +0530 Subject: Add UT for CommonUtil Add UT for CommonUtil in openecomp-be. Issue-ID: SDC-1774 Change-Id: Id197e79ede009f3ca34043f907a48b26af17be53 Signed-off-by: Satyaki Mallick --- .../org/openecomp/sdc/common/utils/CommonUtil.java | 12 +++---- .../openecomp/sdc/common/utils/CommonUtilTest.java | 38 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java (limited to 'openecomp-be/lib/openecomp-common-lib/src') 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 obj = new HashMap<>(1); + obj.put(CommonUtil.DEFAULT, ""); + Map newMap = CommonUtil.getObjectAsMap(obj); + + boolean exists = newMap.containsKey(CommonUtil._DEFAULT); + + assertTrue(exists); + } +} \ No newline at end of file -- cgit 1.2.3-korg