Add a unit test for mdsal 95/16395/1
authorsurya-huawei <a.u.surya@huawei.com>
Thu, 28 Sep 2017 12:29:53 +0000 (17:59 +0530)
committersurya-huawei <a.u.surya@huawei.com>
Thu, 28 Sep 2017 12:31:31 +0000 (18:01 +0530)
*Add a negative unit test case for ConfigResource
This is to check availability of query and
improve sonar code coverage

Issue-Id: CCSDK-106
Change-Id: Ic276d1cfacce3aea7444adcb7bf09d6cdffb294e
Signed-off-by: surya-huawei <a.u.surya@huawei.com>
mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java [new file with mode: 0644]

diff --git a/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java b/mdsal-resource/provider/src/test/java/org/onap/ccsdk/sli/adaptors/resource/mdsal/ConfigResourceTest.java
new file mode 100644 (file)
index 0000000..f5b0bcf
--- /dev/null
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * 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
+ *
+ *      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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.adaptors.resource.mdsal;
+
+import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus;
+
+import static org.junit.Assert.assertEquals;
+
+public class ConfigResourceTest {
+    ConfigResource configResource = new ConfigResource("http", "local",
+                                                       "10001", "admin",
+                                                       "password");
+
+    @Test
+    public void isAvailableNegativeTest() throws SvcLogicException {
+        SvcLogicContext ctx = new SvcLogicContext();
+        assertEquals(QueryStatus.NOT_FOUND, configResource.isAvailable
+                ("xyz", "key", "prefix", ctx));
+    }
+}
+