Added test case for Appc Provider client 50/78750/2
authorLathishbabu Ganesan <lathishbabu.ganesan@ericsson.com>
Tue, 19 Feb 2019 12:29:58 +0000 (07:29 -0500)
committerTakamune Cho <takamune.cho@att.com>
Wed, 20 Feb 2019 15:05:55 +0000 (15:05 +0000)
Increased the coverage from 0% to 100%

Issue-ID: APPC-1455
Change-Id: I0e719bd084a985b63110f15681b6a87ec4affb4d
Signed-off-by: Lathishbabu Ganesan <lathishbabu.ganesan@ericsson.com>
appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/TestAppcProviderClient.java [new file with mode: 0644]

diff --git a/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/TestAppcProviderClient.java b/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/TestAppcProviderClient.java
new file mode 100644 (file)
index 0000000..c4de29d
--- /dev/null
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.provider;
+
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+import java.util.Properties;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
+
+public class TestAppcProviderClient {
+
+    private AppcProviderClient appcProviderClient;
+    private SvcLogicService svcLogicService;
+
+    @Before
+    public void setUp() {
+        svcLogicService = Mockito.mock(SvcLogicService.class);
+        appcProviderClient = new AppcProviderClient(svcLogicService);
+    }
+
+    @Test
+    public void testHasGraph() throws SvcLogicException {
+        when(svcLogicService.hasGraph("APPC", "healthcheck", "1.0", "active")).thenReturn(true);
+        assertTrue(appcProviderClient.hasGraph("APPC", "healthcheck", "1.0", "active"));
+    }
+
+    @Test
+    public void testExecute() throws SvcLogicException {
+        Properties respProps = new Properties();
+        when(svcLogicService.execute("APPC", "healthcheck", "1.0", "active", null)).thenReturn(respProps);
+        assertSame(respProps, appcProviderClient.execute("APPC", "healthcheck", "1.0", "active", null));
+    }
+}