From 4dc98f06ad922fdb4b647114f37e78024df118a3 Mon Sep 17 00:00:00 2001 From: Lathishbabu Ganesan Date: Tue, 19 Feb 2019 07:29:58 -0500 Subject: Added test case for Appc Provider client Increased the coverage from 0% to 100% Issue-ID: APPC-1455 Change-Id: I0e719bd084a985b63110f15681b6a87ec4affb4d Signed-off-by: Lathishbabu Ganesan --- .../onap/appc/provider/TestAppcProviderClient.java | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/TestAppcProviderClient.java (limited to 'appc-provider/appc-provider-bundle/src/test') 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 index 000000000..c4de29d8a --- /dev/null +++ b/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/TestAppcProviderClient.java @@ -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)); + } +} -- cgit 1.2.3-korg