From 9f4304d6085d3cc9a2a242cdbd6a33c10cc91097 Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Tue, 19 Mar 2019 13:32:17 +0530 Subject: [PATCH] added test cases to TestAppcProvider.java to increase code coverage Issue-ID: APPC-1086 Change-Id: Iff273f586c3d6ac9fa3809ef605013f11d3d2178 Signed-off-by: Sandeep J --- .../org/onap/appc/provider/TestAppcProvider.java | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/TestAppcProvider.java b/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/TestAppcProvider.java index 9affec075..4a013df61 100644 --- a/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/TestAppcProvider.java +++ b/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/TestAppcProvider.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2019 Ericsson * ================================================================================ + * Modifications Copyright (C) 2019 IBM. + * ================================================================================ * 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 @@ -21,11 +23,16 @@ package org.onap.appc.provider; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.anyObject; import static org.mockito.Mockito.when; + import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; + import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -41,6 +48,7 @@ import org.opendaylight.yang.gen.v1.org.onap.appc.provider.rev160104.RestartInpu import org.opendaylight.yang.gen.v1.org.onap.appc.provider.rev160104.SnapshotInput; import org.opendaylight.yang.gen.v1.org.onap.appc.provider.rev160104.VmstatuscheckInput; import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yang.gen.v1.org.onap.appc.provider.rev160104.EvacuateInput; public class TestAppcProvider { @@ -57,8 +65,8 @@ public class TestAppcProvider { topologyService = Mockito.mock(TopologyService.class); result = Mockito.mock(RpcResult.class); - appcProvider = - new AppcProvider(dataBroker2, notificationProviderService, rpcProviderRegistry, appcProviderClient); + appcProvider = new AppcProvider(dataBroker2, notificationProviderService, rpcProviderRegistry, + appcProviderClient); } @Test @@ -121,4 +129,15 @@ public class TestAppcProvider { ExecutorService executor = (ExecutorService) Whitebox.getInternalState(appcProvider, "executor"); assertTrue(executor.isShutdown()); } + + @Test + public void testGetClient() { + assertSame(appcProviderClient, appcProvider.getClient()); + } + + @Test + public void testEvacuate() { + EvacuateInput input = null; + assertNull(appcProvider.evacuate(input)); + } } -- 2.16.6