From af88d413093778f9102080e32ebbd3071c81f61d Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Sun, 8 Sep 2019 21:42:11 +0300 Subject: Stabilize AAIServiceTreeIntegrativeTest, assuming a Mocking issue Change-Id: Ia90b5b4cb9fd2d5203df74bea9cb5618d2dd37e7 Issue-ID: VID-378 Signed-off-by: Ittay Stern --- .../services/AAIServiceTreeIntegrativeTest.java | 23 +++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeIntegrativeTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeIntegrativeTest.java index 00a9995cb..e5799bcf0 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeIntegrativeTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeIntegrativeTest.java @@ -40,9 +40,7 @@ import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import javax.ws.rs.core.Response; -import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.onap.vid.aai.AaiClientInterface; import org.onap.vid.aai.ExceptionWithRequestInfo; @@ -58,7 +56,6 @@ import org.onap.vid.model.aaiTree.ServiceInstance; import org.onap.vid.model.aaiTree.Vnf; import org.onap.vid.testUtils.TestUtils; import org.springframework.http.HttpMethod; -import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -79,11 +76,9 @@ public class AAIServiceTreeIntegrativeTest { @Mock ServiceModelInflator serviceModelInflator; - @InjectMocks private AAITreeNodeBuilder aaiTreeNodeBuilder; - @InjectMocks - private AAITreeConverter aaiTreeConverter; + private AAITreeConverter aaiTreeConverter = new AAITreeConverter(); private ExecutorService executorService = Executors.newFixedThreadPool(10); @@ -295,17 +290,17 @@ public class AAIServiceTreeIntegrativeTest { "\"property-key\": \"model-ver.model-name\"," + "\"property-value\": \"service-instance\"}]}]}}]}}]}}]}"; - @BeforeClass + @BeforeMethod public void initMocks() { + aaiClient = null; + aaiGetVersionByInvariantIdResponse = null; + sdcService = null; + serviceModelInflator = null; + exceptionWithRequestInfo = null; + MockitoAnnotations.initMocks(this); - } - @BeforeMethod - public void resetMocks() { - Mockito.reset(aaiClient); - Mockito.reset(aaiGetVersionByInvariantIdResponse); - Mockito.reset(sdcService); - Mockito.reset(serviceModelInflator); + aaiTreeNodeBuilder = new AAITreeNodeBuilder(aaiClient); } public void getServiceInstanceTreeAndAssert(boolean isDuplicatedKeysInTenantRelation) throws IOException, AsdcCatalogException { -- cgit 1.2.3-korg