From f59155c1c12543e54972298a3020e2372edb79b7 Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Tue, 26 Mar 2019 13:41:32 +0530 Subject: added test cases to ArtifactHandlerProviderTest to increase code coverage Issue-ID: APPC-1086 Change-Id: Ic03b32bc4c8b87a76db2e2aae45f7706f19e9bd4 Signed-off-by: Sandeep J --- .../handler/ArtifactHandlerProviderTest.java | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/ArtifactHandlerProviderTest.java b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/ArtifactHandlerProviderTest.java index aa1c86ad2..9b6af8791 100644 --- a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/ArtifactHandlerProviderTest.java +++ b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/ArtifactHandlerProviderTest.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,12 +23,11 @@ package org.onap.appc.artifact.handler; -import com.google.common.util.concurrent.CheckedFuture; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; + import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; + import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; @@ -37,14 +38,15 @@ import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.ArtifactHandlerService; import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.UploadartifactInput; import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.UploadartifactInputBuilder; import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.UploadartifactOutput; import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.document.parameters.DocumentParameters; import org.opendaylight.yang.gen.v1.org.onap.appc.artifacthandler.rev170321.request.information.RequestInformation; -import org.powermock.reflect.Whitebox; +import org.opendaylight.yangtools.yang.common.RpcResult; + +import com.google.common.util.concurrent.CheckedFuture; public class ArtifactHandlerProviderTest { @@ -149,5 +151,20 @@ public class ArtifactHandlerProviderTest { Future> output = (Future>) artifactHandlerProvider.uploadartifact(uploadArtifactInput); assertTrue(output.get().getResult() instanceof UploadartifactOutput); } + + @Test + public void testClose() throws Exception + { + artifactHandlerProvider = new ArtifactHandlerProvider(dataBroker, notificationService, rpcRegistry); + artifactHandlerProvider.close(); + } + + @Test + public void testGetArtifactHandlerProviderUtil() throws Exception + { + artifactHandlerProvider = new ArtifactHandlerProvider(dataBroker, notificationService, rpcRegistry); + UploadartifactInput uploadArtifactInput = Mockito.mock(UploadartifactInput.class); + assertTrue(artifactHandlerProvider.getArtifactHandlerProviderUtil(uploadArtifactInput) instanceof ArtifactHandlerProviderUtil); + } } -- cgit 1.2.3-korg