From 0fbe309f797b4cdac9d507a6f3dfd193644aa224 Mon Sep 17 00:00:00 2001 From: vasraz Date: Mon, 10 Jan 2022 19:23:57 +0000 Subject: Improve testing stability Signed-off-by: Vasyl Razinkov Change-Id: I3f631642a97e65d6628816767e0a5408f02f4bc6 Issue-ID: SDC-3839 --- .../action/rest/services/ActionsImplTest.java | 2 +- .../services/ApplicationConfigurationImplTest.java | 4 ++-- .../externaltesting/rest/services/ApiTest.java | 20 ++++++++++---------- .../validation/rest/service/ValidationImplTest.java | 4 ++-- .../rest/services/ComponentDependenciesImplTest.java | 4 ++-- .../vsp/rest/services/ComponentImplTest.java | 4 ++-- .../services/ComponentMonitoringUploadsImplTest.java | 4 ++-- .../rest/services/ComponentProcessesImplTest.java | 4 ++-- .../sdcrests/vsp/rest/services/ComputeImplTest.java | 4 ++-- .../vsp/rest/services/DeploymentFlavorsImplTest.java | 4 ++-- .../sdcrests/vsp/rest/services/ImagesImplTest.java | 4 ++-- .../sdcrests/vsp/rest/services/NetworksImplTest.java | 4 ++-- .../sdcrests/vsp/rest/services/NicsImplTest.java | 4 ++-- 13 files changed, 33 insertions(+), 33 deletions(-) (limited to 'openecomp-be/api') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/test/java/org/openecomp/sdcrests/action/rest/services/ActionsImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/test/java/org/openecomp/sdcrests/action/rest/services/ActionsImplTest.java index 2d265fc402..ed0da6bf47 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/test/java/org/openecomp/sdcrests/action/rest/services/ActionsImplTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/action-library-rest/action-library-rest-services/src/test/java/org/openecomp/sdcrests/action/rest/services/ActionsImplTest.java @@ -62,7 +62,7 @@ public class ActionsImplTest { @Before public void init() { - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); when(request.getRemoteUser()).thenReturn("unit-test-user"); when(request.getHeader(X_OPEN_ECOMP_INSTANCE_ID_HEADER_PARAM)).thenReturn("X-OPEN-ECOMP-InstanceID"); when(request.getHeader(X_OPEN_ECOMP_REQUEST_ID_HEADER_PARAM)).thenReturn("X-OPEN-ECOMP-RequestID"); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/test/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/test/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImplTest.java index 43ebeab9e5..88194bbacd 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/test/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImplTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/test/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImplTest.java @@ -40,7 +40,7 @@ import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; public class ApplicationConfigurationImplTest { @@ -52,7 +52,7 @@ public class ApplicationConfigurationImplTest { @Before public void setUp() { - initMocks(this); + openMocks(this); applicationConfiguration = new ApplicationConfigurationImpl(applicationConfigManager); } diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/externaltesting-rest/externaltesting-rest-services/src/test/java/org/openecomp/sdcrests/externaltesting/rest/services/ApiTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/externaltesting-rest/externaltesting-rest-services/src/test/java/org/openecomp/sdcrests/externaltesting/rest/services/ApiTest.java index 9ecc92a1b6..3833bb331f 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/externaltesting-rest/externaltesting-rest-services/src/test/java/org/openecomp/sdcrests/externaltesting/rest/services/ApiTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/externaltesting-rest/externaltesting-rest-services/src/test/java/org/openecomp/sdcrests/externaltesting/rest/services/ApiTest.java @@ -17,7 +17,7 @@ package org.openecomp.sdcrests.externaltesting.rest.services; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; import java.util.ArrayList; import java.util.Arrays; @@ -59,7 +59,7 @@ public class ApiTest { @Before public void setUp() { try { - initMocks(this); + openMocks(this); } catch (Exception e) { e.printStackTrace(); } @@ -167,7 +167,7 @@ public class ApiTest { */ @Test() public void testConfigExceptions() { - initMocks(this); + openMocks(this); ExternalTestingManager m = new ApiTestExternalTestingManager(); ExternalTestingImpl testingF = new ExternalTestingImpl(m, vendorSoftwareProductManager); @@ -184,7 +184,7 @@ public class ApiTest { */ @Test() public void testEndpointExceptions() { - initMocks(this); + openMocks(this); ExternalTestingManager m = new ApiTestExternalTestingManager(); ExternalTestingImpl testingF = new ExternalTestingImpl(m, vendorSoftwareProductManager); @@ -201,7 +201,7 @@ public class ApiTest { */ @Test() public void testExecutionExceptions() { - initMocks(this); + openMocks(this); ExternalTestingManager m = new ApiTestExternalTestingManager(); ExternalTestingImpl testingF = new ExternalTestingImpl(m, vendorSoftwareProductManager); @@ -220,7 +220,7 @@ public class ApiTest { */ @Test() public void testScenarioExceptions() { - initMocks(this); + openMocks(this); ExternalTestingManager m = new ApiTestExternalTestingManager(); ExternalTestingImpl testingF = new ExternalTestingImpl(m, vendorSoftwareProductManager); @@ -235,7 +235,7 @@ public class ApiTest { */ @Test() public void testTestCaseExceptions() { - initMocks(this); + openMocks(this); ExternalTestingManager m = new ApiTestExternalTestingManager(); ExternalTestingImpl testingF = new ExternalTestingImpl(m, vendorSoftwareProductManager); @@ -250,7 +250,7 @@ public class ApiTest { */ @Test() public void testTestCasesExceptions() { - initMocks(this); + openMocks(this); ExternalTestingManager m = new ApiTestExternalTestingManager(); ExternalTestingImpl testingF = new ExternalTestingImpl(m, vendorSoftwareProductManager); @@ -265,7 +265,7 @@ public class ApiTest { */ @Test() public void testTestSuitesExceptions() { - initMocks(this); + openMocks(this); ExternalTestingManager m = new ApiTestExternalTestingManager(); ExternalTestingImpl testingF = new ExternalTestingImpl(m, vendorSoftwareProductManager); @@ -280,7 +280,7 @@ public class ApiTest { */ @Test() public void testTreeExceptions() { - initMocks(this); + openMocks(this); ExternalTestingManager m = new ApiTestExternalTestingManager(); ExternalTestingImpl testingF = new ExternalTestingImpl(m, vendorSoftwareProductManager); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/test/java/org/openecomp/sdcrests/validation/rest/service/ValidationImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/test/java/org/openecomp/sdcrests/validation/rest/service/ValidationImplTest.java index d88b3e9772..70e35d065c 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/test/java/org/openecomp/sdcrests/validation/rest/service/ValidationImplTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/test/java/org/openecomp/sdcrests/validation/rest/service/ValidationImplTest.java @@ -35,7 +35,7 @@ import java.io.IOException; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; public class ValidationImplTest { @@ -46,7 +46,7 @@ public class ValidationImplTest { @Before public void setUp(){ - initMocks(this); + openMocks(this); } @Test diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependenciesImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependenciesImplTest.java index fe90ed2528..1bc1e33eab 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependenciesImplTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependenciesImplTest.java @@ -43,7 +43,7 @@ import java.util.Collection; import java.util.Collections; import java.util.UUID; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; import static org.mockito.Mockito.when; public class ComponentDependenciesImplTest { @@ -66,7 +66,7 @@ public class ComponentDependenciesImplTest { @Before public void setUp() { try { - initMocks(this); + openMocks(this); ComponentDependencyModelEntity e = new ComponentDependencyModelEntity(); e.setSourceComponentId("sourceid"); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentImplTest.java index ab64bfca11..85429065c1 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentImplTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentImplTest.java @@ -47,7 +47,7 @@ import java.util.Collection; import java.util.Collections; import java.util.UUID; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; import static org.mockito.Mockito.when; public class ComponentImplTest { @@ -67,7 +67,7 @@ public class ComponentImplTest { @Before public void setUp() { try { - initMocks(this); + openMocks(this); ComponentEntity ce = new ComponentEntity(); ce.setId(vspId); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentMonitoringUploadsImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentMonitoringUploadsImplTest.java index 119a5dbe53..28dc1cbb85 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentMonitoringUploadsImplTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentMonitoringUploadsImplTest.java @@ -41,7 +41,7 @@ import javax.ws.rs.core.Response; import java.io.ByteArrayInputStream; import java.util.UUID; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; import static org.mockito.Mockito.when; public class ComponentMonitoringUploadsImplTest { @@ -64,7 +64,7 @@ public class ComponentMonitoringUploadsImplTest { @Before public void setUp() { try { - initMocks(this); + openMocks(this); MonitoringUploadStatus result = new MonitoringUploadStatus(); result.setSnmpPoll("p"); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImplTest.java index 48011ea740..6320a38720 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImplTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComponentProcessesImplTest.java @@ -47,7 +47,7 @@ import java.util.Collection; import java.util.Collections; import java.util.UUID; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; import static org.mockito.Mockito.when; import static org.mockito.Mockito.mock; @@ -75,7 +75,7 @@ public class ComponentProcessesImplTest { @Before public void setUp() { try { - initMocks(this); + openMocks(this); ProcessEntity pe = new ProcessEntity(); pe.setId(vspId); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImplTest.java index 7cd78e0c1d..8195ae0a5e 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImplTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ComputeImplTest.java @@ -48,7 +48,7 @@ import java.util.Collection; import java.util.Collections; import java.util.UUID; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; import static org.mockito.Mockito.when; public class ComputeImplTest { @@ -72,7 +72,7 @@ public class ComputeImplTest { @Before public void setUp() { try { - initMocks(this); + openMocks(this); ListComputeResponse lcr = new ListComputeResponse(); lcr.setAssociatedWithDeploymentFlavor(false); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImplTest.java index 008ef8134f..4b0710a277 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImplTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/DeploymentFlavorsImplTest.java @@ -44,7 +44,7 @@ import java.util.Collection; import java.util.Collections; import java.util.UUID; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; import static org.mockito.Mockito.when; public class DeploymentFlavorsImplTest { @@ -64,7 +64,7 @@ public class DeploymentFlavorsImplTest { @Before public void setUp() { try { - initMocks(this); + openMocks(this); DeploymentFlavorEntity e = new DeploymentFlavorEntity(); e.setId(deploymentFlavorId); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImplTest.java index 349ab9b401..e7dc2843a7 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImplTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/ImagesImplTest.java @@ -49,7 +49,7 @@ import java.util.Collection; import java.util.Collections; import java.util.UUID; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; import static org.mockito.Mockito.when; public class ImagesImplTest { @@ -79,7 +79,7 @@ public class ImagesImplTest { @Before public void setUp() { try { - initMocks(this); + openMocks(this); ImageEntity ie = new ImageEntity(); ie.setComponentId(componentId); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImplTest.java index 756e8fdde3..0fcb19d5d4 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImplTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/NetworksImplTest.java @@ -21,7 +21,7 @@ package org.openecomp.sdcrests.vsp.rest.services; import static org.mockito.Mockito.when; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; import java.util.Collection; import java.util.Collections; @@ -57,7 +57,7 @@ public class NetworksImplTest { @Before public void setUp() { - initMocks(this); + openMocks(this); NetworkEntity e = new NetworkEntity(); e.setId(networkId); diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/NicsImplTest.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/NicsImplTest.java index a6a4e98f82..4f0a5d3cdd 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/NicsImplTest.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/test/java/org/openecomp/sdcrests/vsp/rest/services/NicsImplTest.java @@ -47,7 +47,7 @@ import java.util.Collection; import java.util.Collections; import java.util.UUID; -import static org.mockito.MockitoAnnotations.initMocks; +import static org.mockito.MockitoAnnotations.openMocks; import static org.mockito.Mockito.when; public class NicsImplTest { @@ -71,7 +71,7 @@ public class NicsImplTest { @Before public void setUp() { try { - initMocks(this); + openMocks(this); NicEntity e = new NicEntity(); e.setComponentId(componentId); -- cgit 1.2.3-korg