diff options
54 files changed, 296 insertions, 296 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java index 71cb08c9da..f06101d8db 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/PropertyBusinessLogicTest.java @@ -35,7 +35,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; @@ -387,7 +386,7 @@ class PropertyBusinessLogicTest extends BaseBusinessLogicMock { resource.setLastUpdaterUserId("USR01"); when(toscaOperationFacade.getToscaElement("RES01")).thenReturn(Either.left(resource)); - when(toscaOperationFacade.deletePropertyOfComponent(anyObject(), anyString())).thenReturn(StorageOperationStatus.OK); + when(toscaOperationFacade.deletePropertyOfComponent(any(), anyString())).thenReturn(StorageOperationStatus.OK); when(toscaOperationFacade.getParentComponents(anyString())).thenReturn(Either.left(new ArrayList<>())); assertTrue(propertyBusinessLogic.deletePropertyFromComponent("RES01", "PROP", "USR01").isRight()); diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEnginePollingTaskTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEnginePollingTaskTest.java index 95e3553990..6780bef6b2 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEnginePollingTaskTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEnginePollingTaskTest.java @@ -42,7 +42,7 @@ class DistributionEnginePollingTaskTest extends BeConfDependentTest { // TODO - remove this setup after migration to Junit5 BeConfDependentTest @BeforeAll - private static void setup() { + static void setup() { configurationManager = new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be")); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java index 94245c76d7..3e70a3229f 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/distribution/engine/DistributionEngineTest.java @@ -50,7 +50,7 @@ import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class DistributionEngineTest{ @@ -111,7 +111,7 @@ public class DistributionEngineTest{ when(environmentsEngine.getEnvironments()).thenReturn(envs); ActionStatus actionStatus = testInstance.notifyService(DISTRIBUTION_ID, new Service(), new NotificationDataImpl(), "someNonExisitngEnv", modifier); assertEquals(ActionStatus.DISTRIBUTION_ENVIRONMENT_NOT_AVAILABLE, actionStatus); - verifyZeroInteractions(distributionNotificationSender); + verifyNoInteractions(distributionNotificationSender); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicHealthTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicHealthTest.java index eee5e3cf56..41ff6c0e36 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicHealthTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogicHealthTest.java @@ -52,7 +52,7 @@ class HealthCheckBusinessLogicHealthTest extends BeConfDependentTest { // TODO - remove this setup after migration to Junit5 BeConfDependentTest @BeforeAll - private static void setup() { + static void setup() { configurationManager = new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be")); } @@ -79,7 +79,7 @@ class HealthCheckBusinessLogicHealthTest extends BeConfDependentTest { } @BeforeEach - private void beforeTest() { + void beforeTest() { when(dmaapProducerHealth.getHealthCheckInfo()) .thenReturn(dmaapProducerHealthCheckInfo); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java index 4cb32658d0..86308942c3 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogicTest.java @@ -66,7 +66,6 @@ import java.util.stream.Stream; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyCollection; -import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; @@ -109,18 +108,18 @@ public class CapabilitiesBusinessLogicTest extends BaseBusinessLogicMock { .thenReturn(StorageOperationStatus.OK); //CapabilityOperation - when(capabilitiesValidation.validateCapabilities(anyCollection(), anyObject(), anyBoolean())) + when(capabilitiesValidation.validateCapabilities(anyCollection(), any(), anyBoolean())) .thenReturn(Either.left(true)); - when(capabilitiesOperation.addCapabilities(anyString(), anyObject())) + when(capabilitiesOperation.addCapabilities(anyString(), any())) .thenReturn(Either.left(createMockCapabilityListToReturn( createCapability("capName", "capDesc", "capType", "source1", "0", "10")))); - when(capabilitiesOperation.updateCapabilities(anyString(), anyObject())) + when(capabilitiesOperation.updateCapabilities(anyString(), any())) .thenReturn(Either.left(createMockCapabilityListToReturn( createCapability("capName", "capDesc", "capType", "source1", "0", "10")))); - when(capabilitiesOperation.deleteCapabilities( anyObject(), anyString())) + when(capabilitiesOperation.deleteCapabilities( any(), anyString())) .thenReturn(StorageOperationStatus.OK); when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); @@ -182,9 +181,9 @@ public class CapabilitiesBusinessLogicTest extends BaseBusinessLogicMock { Resource resource = createComponent(true); resource.setComponentType(ComponentTypeEnum.RESOURCE); validateUserRoles(Role.ADMIN, Role.DESIGNER); - when(capabilitiesOperation.addCapabilities(anyString(), anyObject())) + when(capabilitiesOperation.addCapabilities(anyString(), any())) .thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR)); - when(capabilitiesOperation.updateCapabilities(anyString(), anyObject())) + when(capabilitiesOperation.updateCapabilities(anyString(), any())) .thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR)); when(toscaOperationFacade.getToscaElement(anyString(), any(ComponentParametersView.class))) .thenReturn(Either.left(resource)); @@ -278,9 +277,9 @@ public class CapabilitiesBusinessLogicTest extends BaseBusinessLogicMock { Resource resource = createComponent(true); resource.setComponentType(ComponentTypeEnum.RESOURCE); validateUserRoles(Role.ADMIN, Role.DESIGNER); - when(capabilitiesOperation.addCapabilities(anyString(), anyObject())) + when(capabilitiesOperation.addCapabilities(anyString(), any())) .thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR)); - when(capabilitiesOperation.updateCapabilities(anyString(), anyObject())) + when(capabilitiesOperation.updateCapabilities(anyString(), any())) .thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR)); when(toscaOperationFacade.getToscaElement(anyString(), any(ComponentParametersView.class))) .thenReturn(Either.left(resource)); @@ -317,7 +316,7 @@ public class CapabilitiesBusinessLogicTest extends BaseBusinessLogicMock { .thenReturn(Either.left(resource)); when(toscaOperationFacade.getParentComponents(anyString())) .thenReturn(Either.right(StorageOperationStatus.NOT_FOUND)); - when(capabilitiesOperation.deleteCapabilities(anyObject(), anyString())) + when(capabilitiesOperation.deleteCapabilities(any(), anyString())) .thenReturn(StorageOperationStatus.GENERAL_ERROR); Either<CapabilityDefinition, ResponseFormat> deleteCapabilityEither = capabilitiesBusinessLogicMock.deleteCapability(componentId, capabilityId, user, true); @@ -477,4 +476,4 @@ public class CapabilitiesBusinessLogicTest extends BaseBusinessLogicMock { return service; } -}
\ No newline at end of file +} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java index 141aae7a5a..95d06e3b7b 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogicTest.java @@ -36,7 +36,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.anyMap; -import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.when; @@ -282,7 +281,7 @@ class GroupBusinessLogicTest { component.setUniqueId("GRP.01"); component.setGroups(grpdefList); when(accessValidations.validateUserCanWorkOnComponent("compid", ComponentTypeEnum.SERVICE, "USR01", "DeleteGroup")).thenReturn(component); - when(groupsOperation.deleteGroups(anyObject(), anyList())).thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND)); + when(groupsOperation.deleteGroups(any(), anyList())).thenReturn(Either.right(StorageOperationStatus.ARTIFACT_NOT_FOUND)); when(janusGraphDao.rollback()).thenReturn(JanusGraphOperationStatus.OK); assertThrows(ComponentException.class, () -> { @@ -305,9 +304,9 @@ class GroupBusinessLogicTest { List<GroupDefinition> groupDefListCopy = new ArrayList<>(); groupDefListCopy.add(updatedGroup); when(accessValidations.validateUserCanWorkOnComponent("compid", ComponentTypeEnum.SERVICE, "USR01", "DeleteGroup")).thenReturn(component); - when(groupsOperation.deleteGroups(anyObject(), anyList())).thenReturn(Either.left(groupDefListCopy)); - when(groupsOperation.deleteCalculatedCapabilitiesWithProperties(anyString(), anyObject())).thenReturn(StorageOperationStatus.OK); - when(policyTargetsUpdateHandler.removePoliciesTargets(anyObject(), anyString(), anyObject())).thenReturn(ActionStatus.OK); + when(groupsOperation.deleteGroups(any(), anyList())).thenReturn(Either.left(groupDefListCopy)); + when(groupsOperation.deleteCalculatedCapabilitiesWithProperties(anyString(), any())).thenReturn(StorageOperationStatus.OK); + when(policyTargetsUpdateHandler.removePoliciesTargets(any(), anyString(), any())).thenReturn(ActionStatus.OK); GroupDefinition Gdefinition = test.deleteGroup("compid", ComponentTypeEnum.SERVICE, "GRP.01", "USR01"); @@ -426,4 +425,4 @@ class GroupBusinessLogicTest { Assertions.assertEquals(10, result); } -}
\ No newline at end of file +} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java index 63a9d3cbe0..c9043e02f1 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogicTest.java @@ -63,7 +63,6 @@ import java.util.stream.Stream; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyCollection; -import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; @@ -105,18 +104,18 @@ public class RequirementBusinessLogicTest extends BaseBusinessLogicMock { .thenReturn(StorageOperationStatus.OK); //CapabilityOperation - when(requirementValidation.validateRequirements(anyCollection(), anyObject(), anyBoolean())) + when(requirementValidation.validateRequirements(anyCollection(), any(), anyBoolean())) .thenReturn(Either.left(true)); - when(requirementOperation.addRequirement(anyString(), anyObject())) + when(requirementOperation.addRequirement(anyString(), any())) .thenReturn(Either.left(createMockRequirementListToReturn(createRequirement( "reqName", "capType", "node", "source1", "0", "10")))); - when(requirementOperation.updateRequirement(anyString(), anyObject())) + when(requirementOperation.updateRequirement(anyString(), any())) .thenReturn(Either.left(createMockRequirementListToReturn(createRequirement( "reqName", "capType", "node", "source1", "0", "10")))); - when(requirementOperation.deleteRequirements( anyObject(), anyString())) + when(requirementOperation.deleteRequirements( any(), anyString())) .thenReturn(StorageOperationStatus.OK); when(mockJanusGraphDao.commit()).thenReturn(JanusGraphOperationStatus.OK); @@ -268,9 +267,9 @@ public class RequirementBusinessLogicTest extends BaseBusinessLogicMock { Resource resource = createComponent(true); resource.setComponentType(ComponentTypeEnum.RESOURCE); validateUserRoles(Role.ADMIN, Role.DESIGNER); - when(requirementOperation.addRequirement(anyString(), anyObject())) + when(requirementOperation.addRequirement(anyString(), any())) .thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR)); - when(requirementOperation.updateRequirement(anyString(), anyObject())) + when(requirementOperation.updateRequirement(anyString(), any())) .thenReturn(Either.right(StorageOperationStatus.GENERAL_ERROR)); when(toscaOperationFacade.getToscaElement(anyString(), any(ComponentParametersView.class))) .thenReturn(Either.left(resource)); @@ -291,7 +290,7 @@ public class RequirementBusinessLogicTest extends BaseBusinessLogicMock { .thenReturn(Either.left(resource)); when(toscaOperationFacade.getParentComponents(anyString())) .thenReturn(Either.right(StorageOperationStatus.NOT_FOUND)); - when(requirementOperation.deleteRequirements(anyObject(), anyString())) + when(requirementOperation.deleteRequirements(any(), anyString())) .thenReturn(StorageOperationStatus.GENERAL_ERROR); Either<RequirementDefinition, ResponseFormat> deleteRequirementEither = requirementsBusinessLogicMock.deleteRequirement(componentId, requirementId, user, true); @@ -405,4 +404,4 @@ public class RequirementBusinessLogicTest extends BaseBusinessLogicMock { return service; } -}
\ No newline at end of file +} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/ComponentInstanceChangeOperationOrchestratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/ComponentInstanceChangeOperationOrchestratorTest.java index 17063468fc..399227bc4f 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/ComponentInstanceChangeOperationOrchestratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/ComponentInstanceChangeOperationOrchestratorTest.java @@ -31,7 +31,7 @@ import org.openecomp.sdc.be.model.Resource; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) @@ -59,7 +59,7 @@ public class ComponentInstanceChangeOperationOrchestratorTest { when(componentInstanceChangeOperation1.onChangeVersion(CONTAINER, PREV_VERSION, NEW_VERSION)).thenReturn(ActionStatus.GENERAL_ERROR); ActionStatus actionStatus = testInstance.doPostChangeVersionOperations(CONTAINER, PREV_VERSION, NEW_VERSION); assertThat(actionStatus).isEqualTo(ActionStatus.GENERAL_ERROR); - verifyZeroInteractions(componentInstanceChangeOperation2, componentInstanceChangeOperation3); + verifyNoInteractions(componentInstanceChangeOperation2, componentInstanceChangeOperation3); } @Test @@ -68,7 +68,7 @@ public class ComponentInstanceChangeOperationOrchestratorTest { when(componentInstanceChangeOperation2.onChangeVersion(CONTAINER, PREV_VERSION, NEW_VERSION)).thenReturn(ActionStatus.GENERAL_ERROR); ActionStatus actionStatus = testInstance.doPostChangeVersionOperations(CONTAINER, PREV_VERSION, NEW_VERSION); assertThat(actionStatus).isEqualTo(ActionStatus.GENERAL_ERROR); - verifyZeroInteractions(componentInstanceChangeOperation3); + verifyNoInteractions(componentInstanceChangeOperation3); } @Test @@ -94,7 +94,7 @@ public class ComponentInstanceChangeOperationOrchestratorTest { when(componentInstanceChangeOperation1.onDelete(CONTAINER, DELETED_INS_ID)).thenReturn(ActionStatus.GENERAL_ERROR); ActionStatus actionStatus = testInstance.doOnDeleteInstanceOperations(CONTAINER, DELETED_INS_ID); assertThat(actionStatus).isEqualTo(ActionStatus.GENERAL_ERROR); - verifyZeroInteractions(componentInstanceChangeOperation2, componentInstanceChangeOperation3); + verifyNoInteractions(componentInstanceChangeOperation2, componentInstanceChangeOperation3); } @Test @@ -103,7 +103,7 @@ public class ComponentInstanceChangeOperationOrchestratorTest { when(componentInstanceChangeOperation2.onDelete(CONTAINER, DELETED_INS_ID)).thenReturn(ActionStatus.GENERAL_ERROR); ActionStatus actionStatus = testInstance.doOnDeleteInstanceOperations(CONTAINER, DELETED_INS_ID); assertThat(actionStatus).isEqualTo(ActionStatus.GENERAL_ERROR); - verifyZeroInteractions(componentInstanceChangeOperation3); + verifyNoInteractions(componentInstanceChangeOperation3); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/PolicyTargetsUpdateOperationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/PolicyTargetsUpdateOperationTest.java index 4631188254..924f5b21bf 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/PolicyTargetsUpdateOperationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/instance/PolicyTargetsUpdateOperationTest.java @@ -46,7 +46,7 @@ import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.openecomp.sdc.be.components.impl.utils.TestGenerationUtils.getComponentsUtils; @@ -86,7 +86,7 @@ public class PolicyTargetsUpdateOperationTest { ComponentInstance newVersion = new ComponentInstanceBuilder().setId("newVersion").build(); ActionStatus operationStatus = policyTargetsUpdateOperation.onChangeVersion(container, prevVersion, newVersion); assertThat(operationStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(toscaOperationFacade); + verifyNoInteractions(toscaOperationFacade); } @Test @@ -97,7 +97,7 @@ public class PolicyTargetsUpdateOperationTest { ComponentInstance newVersion = new ComponentInstanceBuilder().setId("newVersion").build(); ActionStatus operationStatus = policyTargetsUpdateOperation.onChangeVersion(container, prevVersion, newVersion); assertThat(operationStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(toscaOperationFacade); + verifyNoInteractions(toscaOperationFacade); } @Test @@ -106,7 +106,7 @@ public class PolicyTargetsUpdateOperationTest { ComponentInstance newVersion = new ComponentInstanceBuilder().setId("newVersion").build(); ActionStatus operationStatus = policyTargetsUpdateOperation.onChangeVersion(container, prevVersion, newVersion); assertThat(operationStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(toscaOperationFacade); + verifyNoInteractions(toscaOperationFacade); } @Test @@ -136,7 +136,7 @@ public class PolicyTargetsUpdateOperationTest { Component container = new Resource(); ActionStatus operationStatus = policyTargetsUpdateOperation.onDelete(container, "instToDel"); assertThat(operationStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(toscaOperationFacade); + verifyNoInteractions(toscaOperationFacade); } @Test @@ -145,14 +145,14 @@ public class PolicyTargetsUpdateOperationTest { Component container = new ResourceBuilder().addPolicy(policy).build(); ActionStatus operationStatus = policyTargetsUpdateOperation.onDelete(container, "instToDel"); assertThat(operationStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(toscaOperationFacade); + verifyNoInteractions(toscaOperationFacade); } @Test public void onDeleteInstance_whenNoPoliciesWithInstanceAsTarget_returnActionOk() { ActionStatus operationStatus = policyTargetsUpdateOperation.onDelete(container, "instToDel"); assertThat(operationStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(toscaOperationFacade); + verifyNoInteractions(toscaOperationFacade); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandlerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandlerTest.java index 2723746ae4..ee05e41bf7 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandlerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/policy/PolicyTargetsUpdateHandlerTest.java @@ -45,7 +45,7 @@ import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.openecomp.sdc.be.components.impl.utils.TestGenerationUtils.getComponentsUtils; @@ -82,7 +82,7 @@ public class PolicyTargetsUpdateHandlerTest { public void onDeleteInstance_whenNoPolicies_returnActionOk() { Component container = new Resource(); testInstance.removePoliciesTargets(container, "groupToDel", PolicyTargetType.GROUPS); - verifyZeroInteractions(toscaOperationFacade); + verifyNoInteractions(toscaOperationFacade); } @Test @@ -90,13 +90,13 @@ public class PolicyTargetsUpdateHandlerTest { PolicyDefinition policy = PolicyDefinitionBuilder.create().addComponentInstanceTarget("someInst").build(); Component container = new ResourceBuilder().addPolicy(policy).build(); testInstance.removePoliciesTargets(container, "groupToDel", PolicyTargetType.GROUPS); - verifyZeroInteractions(toscaOperationFacade); + verifyNoInteractions(toscaOperationFacade); } @Test public void onDeleteInstance_whenNoPoliciesWithGivenGroupAsTarget_returnActionOk() { testInstance.removePoliciesTargets(container, "groupToDel", PolicyTargetType.GROUPS); - verifyZeroInteractions(toscaOperationFacade); + verifyNoInteractions(toscaOperationFacade); } @Test @@ -135,4 +135,4 @@ public class PolicyTargetsUpdateHandlerTest { Stream.of(groupId).forEach(policyDefinitionBuilder::addGroupTarget); return policyDefinitionBuilder.setUniqueId(uniqueId).build(); } -}
\ No newline at end of file +} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java index 458d104026..978c5344cd 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/GlobalInputsFilteringBusinessLogicTest.java @@ -43,7 +43,7 @@ import java.util.stream.Collectors; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class GlobalInputsFilteringBusinessLogicTest { @@ -91,7 +91,7 @@ public class GlobalInputsFilteringBusinessLogicTest { Either<List<InputDefinition>, ActionStatus> globalInputsEither = testInstance.filterGlobalInputs(mockResource); assertTrue(globalInputsEither.isRight()); assertEquals(ActionStatus.GENERAL_ERROR, globalInputsEither.right().value()); - verifyZeroInteractions(genericTypeBusinessLogicMock); + verifyNoInteractions(genericTypeBusinessLogicMock); } private void verifyFilteredOnlyGlobalInputs(Either<List<InputDefinition>, ActionStatus> globalInputsEither, String[] genericProperties) { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommandTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommandTest.java index a8e610f2dc..cfcdecfe56 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommandTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/ComponentGroupMergeCommandTest.java @@ -52,7 +52,7 @@ import static java.util.Collections.singletonList; import static java.util.stream.Collectors.toMap; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) @@ -81,7 +81,7 @@ public class ComponentGroupMergeCommandTest { actionStatus = testInstance.mergeComponents(prevResource, DONT_CARE); assertThat(actionStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(groupsOperation); + verifyNoInteractions(groupsOperation); } @Test @@ -91,7 +91,7 @@ public class ComponentGroupMergeCommandTest { Resource prevResource = createResourceWithGroups(group1, group2); ActionStatus actionStatus = testInstance.mergeComponents(prevResource, DONT_CARE); assertThat(actionStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(groupsOperation); + verifyNoInteractions(groupsOperation); } @Test @@ -103,7 +103,7 @@ public class ComponentGroupMergeCommandTest { Resource currResource = createResourceWithGroups(group1, group2, group3); ActionStatus actionStatus = testInstance.mergeComponents(prevResource, currResource); assertThat(actionStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(groupsOperation); + verifyNoInteractions(groupsOperation); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommandTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommandTest.java index 42dec9469e..d065546486 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommandTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/group/GroupPropertiesMergeCommandTest.java @@ -49,7 +49,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) @@ -98,14 +98,14 @@ public class GroupPropertiesMergeCommandTest { public void whenNewComponentHasNoGroups_returnOk() { ActionStatus mergeStatus = testInstance.mergeComponents(prevResource, new Resource()); assertThat(mergeStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(mergeBusinessLogic, groupsOperation); + verifyNoInteractions(mergeBusinessLogic, groupsOperation); } @Test public void whenOldComponentHasNoGroups_returnOk() { ActionStatus mergeStatus = testInstance.mergeComponents(new Resource(), newResource); assertThat(mergeStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(mergeBusinessLogic, groupsOperation); + verifyNoInteractions(mergeBusinessLogic, groupsOperation); } @Test @@ -120,7 +120,7 @@ public class GroupPropertiesMergeCommandTest { Resource newResource = createResourceWithGroups(newGrpWithProps, newGrpNoProps); ActionStatus mergeStatus = testInstance.mergeComponents(prevResource, newResource); assertThat(mergeStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(mergeBusinessLogic, groupsOperation); + verifyNoInteractions(mergeBusinessLogic, groupsOperation); } @Test @@ -131,7 +131,7 @@ public class GroupPropertiesMergeCommandTest { Resource newResource = createResourceWithGroups(newUserDefinedGrp); ActionStatus mergeStatus = testInstance.mergeComponents(prevResource, newResource); assertThat(mergeStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(mergeBusinessLogic, groupsOperation); + verifyNoInteractions(mergeBusinessLogic, groupsOperation); } @Test @@ -142,7 +142,7 @@ public class GroupPropertiesMergeCommandTest { Resource newResource = createResourceWithGroups(newGrp); ActionStatus mergeStatus = testInstance.mergeComponents(prevResource, newResource); assertThat(mergeStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(mergeBusinessLogic, groupsOperation); + verifyNoInteractions(mergeBusinessLogic, groupsOperation); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java index ccfd04f050..276c8ae91a 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceCapabilitiesMergeBLTest.java @@ -64,7 +64,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) @@ -209,7 +209,7 @@ public class ComponentInstanceCapabilitiesMergeBLTest { when(toscaOperationFacade.updateComponentCalculatedCapabilitiesProperties(newResource)).thenReturn(StorageOperationStatus.OK); ActionStatus actionStatus = testInstance.mergeComponents(prevResource, newResource); assertThat(actionStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(dataDefinitionsValuesMergingBusinessLogic); + verifyNoInteractions(dataDefinitionsValuesMergingBusinessLogic); } @Test @@ -220,7 +220,7 @@ public class ComponentInstanceCapabilitiesMergeBLTest { verifyNoMoreInteractions(toscaOperationFacade); ActionStatus actionStatus = testInstance.mergeComponents(prevResource, newResource); assertThat(actionStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(dataDefinitionsValuesMergingBusinessLogic); + verifyNoInteractions(dataDefinitionsValuesMergingBusinessLogic); } @Test @@ -268,7 +268,7 @@ public class ComponentInstanceCapabilitiesMergeBLTest { public void mergeInstanceCapabilityProperties_emptyCapabilitiesList() { ActionStatus actionStatus = testInstance.mergeComponentInstanceCapabilities(new Resource(), new Resource(), "instanceId", Collections.emptyList()); assertThat(actionStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(toscaOperationFacade, dataDefinitionsValuesMergingBusinessLogic, capabilityResolver); + verifyNoInteractions(toscaOperationFacade, dataDefinitionsValuesMergingBusinessLogic, capabilityResolver); } @Test @@ -291,6 +291,6 @@ public class ComponentInstanceCapabilitiesMergeBLTest { when(toscaOperationFacade.updateComponentInstanceCapabilityProperties(container, INSTANCE1)).thenReturn(StorageOperationStatus.OK); ActionStatus actionStatus = testInstance.mergeComponentInstanceCapabilities(container, resource, INSTANCE1, prevCapabilities); assertThat(actionStatus).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(dataDefinitionsValuesMergingBusinessLogic); + verifyNoInteractions(dataDefinitionsValuesMergingBusinessLogic); } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java index e12010c750..f3bf0ae439 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstancePropsAndInputsMergeTest.java @@ -26,7 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import fj.data.Either; @@ -146,7 +146,7 @@ class ComponentInstancePropsAndInputsMergeTest { assertThrows(ComponentException.class, () -> { testInstance.mergeDataAfterCreate(USER, dataHolder, service, "inst1"); }); - verifyZeroInteractions(componentInstanceInputsRedeclareHandler, componentInstancePropertiesMergeBL, toscaOperationFacade); + verifyNoInteractions(componentInstanceInputsRedeclareHandler, componentInstancePropertiesMergeBL, toscaOperationFacade); } @Test @@ -162,7 +162,7 @@ class ComponentInstancePropsAndInputsMergeTest { assertThrows(ComponentException.class, () -> { testInstance.mergeDataAfterCreate(USER, dataHolder, service, "inst1"); }); - verifyZeroInteractions(componentInstanceInputsRedeclareHandler, toscaOperationFacade); + verifyNoInteractions(componentInstanceInputsRedeclareHandler, toscaOperationFacade); } @Test @@ -182,7 +182,7 @@ class ComponentInstancePropsAndInputsMergeTest { assertThrows(ComponentException.class, () -> { testInstance.mergeDataAfterCreate(USER, dataHolder, service, "inst1"); }); - verifyZeroInteractions(componentInstanceInputsRedeclareHandler); + verifyNoInteractions(componentInstanceInputsRedeclareHandler); } private void assertComponentFilter(ComponentParametersView value) { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java index a12335c4f9..595e27813d 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/instance/ExternalRefsMergeBLTest.java @@ -46,7 +46,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) @@ -104,7 +104,7 @@ public class ExternalRefsMergeBLTest { containerComponent.setComponentInstances(Collections.singletonList(ci)); DataForMergeHolder dataForMergeHolder = new DataForMergeHolder(); externalRefsMergeBL.mergeDataAfterCreate(new User(), dataForMergeHolder, containerComponent, NEW_INSTANCE_ID); - verifyZeroInteractions(externalReferencesOperation); + verifyNoInteractions(externalReferencesOperation); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommandTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommandTest.java index 42f86984e7..87a01edd74 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommandTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/policy/PoliciesMergeCommandTest.java @@ -52,7 +52,7 @@ import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) @@ -149,7 +149,7 @@ public class PoliciesMergeCommandTest { public void whenPreviousComponentHasNoPolicies_returnOk() { ActionStatus mergeResult = testInstance.mergeComponents(new Resource(), DONT_CARE); assertThat(mergeResult).isEqualTo(ActionStatus.OK); - verifyZeroInteractions(toscaOperationFacade, componentsUtils); + verifyNoInteractions(toscaOperationFacade, componentsUtils); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/DataDefinitionsValuesMergingBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/DataDefinitionsValuesMergingBusinessLogicTest.java index aa7f606a94..84c24f510f 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/DataDefinitionsValuesMergingBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/property/DataDefinitionsValuesMergingBusinessLogicTest.java @@ -60,7 +60,7 @@ public class DataDefinitionsValuesMergingBusinessLogicTest { newProp1.setType("int"); testInstance.mergeInstanceDataDefinitions(Collections.singletonList(oldProp1), Collections.emptyList(), Collections.singletonList(newProp1), Collections.emptyList()); - Mockito.verifyZeroInteractions(propertyDataValueMergeBusinessLogicMock); + Mockito.verifyNoInteractions(propertyDataValueMergeBusinessLogicMock); } @Test @@ -78,7 +78,7 @@ public class DataDefinitionsValuesMergingBusinessLogicTest { .setValue("val1").build(); testInstance.mergeInstanceDataDefinitions(Collections.singletonList(oldProp1), Collections.emptyList(), Collections.singletonList(newProp1), Collections.emptyList()); - Mockito.verifyZeroInteractions(propertyDataValueMergeBusinessLogicMock); + Mockito.verifyNoInteractions(propertyDataValueMergeBusinessLogicMock); } @Test @@ -120,7 +120,7 @@ public class DataDefinitionsValuesMergingBusinessLogicTest { PropertyDataDefinition oldProp = createPropertyDataDefinition("prop1", "oldVal1"); PropertyDataDefinition newProp = createPropertyDataDefinition("prop2", null); testInstance.mergeInstanceDataDefinitions(Collections.singletonList(oldProp), Collections.emptyList(), Collections.singletonList(newProp), Collections.emptyList()); - Mockito.verifyZeroInteractions(propertyDataValueMergeBusinessLogicMock); + Mockito.verifyNoInteractions(propertyDataValueMergeBusinessLogicMock); } private PropertyDataDefinition createPropertyDataDefinition(String name, String value) { diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/resource/ResourceDataMergeBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/resource/ResourceDataMergeBusinessLogicTest.java index 7f47a01c0e..d44618e3a1 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/resource/ResourceDataMergeBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/merge/resource/ResourceDataMergeBusinessLogicTest.java @@ -35,7 +35,7 @@ import org.openecomp.sdc.be.model.Resource; import static java.util.Arrays.asList; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) @@ -70,7 +70,7 @@ public class ResourceDataMergeBusinessLogicTest { when(mergeCommandsFactory.getMergeCommands(oldResource, newResource)).thenReturn(Either.right(ActionStatus.GENERAL_ERROR)); ActionStatus actionStatus = testInstance.mergeResourceEntities(oldResource, newResource); assertEquals(ActionStatus.GENERAL_ERROR, actionStatus); - verifyZeroInteractions(commandA, commandB, commandC); + verifyNoInteractions(commandA, commandB, commandC); } @Test @@ -88,7 +88,7 @@ public class ResourceDataMergeBusinessLogicTest { ActionStatus actionStatus = testInstance.mergeResourceEntities(oldResource, newResource); assertEquals(ActionStatus.GENERAL_ERROR, actionStatus); verify(commandA).description(); - verifyZeroInteractions(commandB, commandC); + verifyNoInteractions(commandB, commandC); } } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBusinessLogicTest.java index 5f0282b7d6..926522ecdc 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBusinessLogicTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/path/ForwardingPathBusinessLogicTest.java @@ -46,7 +46,7 @@ import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; public class ForwardingPathBusinessLogicTest extends BaseForwardingPathTest { @BeforeAll - private static void setup() { + static void setup() { configurationManager = new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be")); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclaratorTest.java index bcbd07db31..933d21db05 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclaratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/ComponentInstancePropertyDeclaratorTest.java @@ -60,7 +60,7 @@ import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.openecomp.sdc.be.components.property.CapabilityTestUtils.createCapabilityDefinition; import static org.openecomp.sdc.be.components.property.CapabilityTestUtils.createProperties; @@ -91,7 +91,7 @@ public class ComponentInstancePropertyDeclaratorTest extends PropertyDeclaratorT Component cmpt = new Resource(); Either<List<InputDefinition>, StorageOperationStatus> createdInputs = testInstance.declarePropertiesAsInputs(cmpt, "someCmptInstId", Collections.emptyList()); assertEquals(StorageOperationStatus.NOT_FOUND, createdInputs.right().value()); - verifyZeroInteractions(toscaOperationFacade); + verifyNoInteractions(toscaOperationFacade); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/GroupPropertyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/GroupPropertyDeclaratorTest.java index 616e0babfa..a5214314e4 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/GroupPropertyDeclaratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/GroupPropertyDeclaratorTest.java @@ -52,7 +52,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) @@ -86,7 +86,7 @@ public class GroupPropertyDeclaratorTest extends PropertyDeclaratorTestBase { public void testDeclarePropertiesAsInputs_groupNotExist() { Either<List<InputDefinition>, StorageOperationStatus> declareResult = groupPropertyDeclarator.declarePropertiesAsInputs(resource, "nonExistingGroup", Collections.emptyList()); assertEquals(StorageOperationStatus.NOT_FOUND, declareResult.right().value()); - verifyZeroInteractions(groupOperation); + verifyNoInteractions(groupOperation); } @Test @@ -113,14 +113,14 @@ public class GroupPropertyDeclaratorTest extends PropertyDeclaratorTestBase { Resource resource = new Resource(); StorageOperationStatus storageOperationStatus = groupPropertyDeclarator.unDeclarePropertiesAsInputs(resource, input); assertEquals(StorageOperationStatus.OK, storageOperationStatus); - verifyZeroInteractions(groupOperation); + verifyNoInteractions(groupOperation); } @Test public void testUnDeclareProperties_whenNoPropertiesFromGroupMatchInputId_returnOk() { StorageOperationStatus storageOperationStatus = groupPropertyDeclarator.unDeclarePropertiesAsInputs(createResourceWithGroup(), input); assertEquals(StorageOperationStatus.OK, storageOperationStatus); - verifyZeroInteractions(groupOperation); + verifyNoInteractions(groupOperation); } @Test @@ -163,14 +163,14 @@ public class GroupPropertyDeclaratorTest extends PropertyDeclaratorTestBase { Resource resource = new Resource(); StorageOperationStatus storageOperationStatus = groupPropertyDeclarator.unDeclarePropertiesAsListInputs(resource, input); assertEquals(StorageOperationStatus.OK, storageOperationStatus); - verifyZeroInteractions(groupOperation); + verifyNoInteractions(groupOperation); } @Test public void testUnDeclarePropertiesAsListInputs_whenNoPropertiesFromGroupMatchInputId_returnOk() { StorageOperationStatus storageOperationStatus = groupPropertyDeclarator.unDeclarePropertiesAsListInputs(createResourceWithGroup(), input); assertEquals(StorageOperationStatus.OK, storageOperationStatus); - verifyZeroInteractions(groupOperation); + verifyNoInteractions(groupOperation); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java index c029725dfe..2428985370 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeceleratorTest.java @@ -49,7 +49,7 @@ import java.util.stream.Stream; import static org.assertj.core.api.Java6Assertions.assertThat; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @@ -86,7 +86,7 @@ public class PolicyPropertyDeceleratorTest extends PropertyDeceleratorTestBase{ public void testDeclarePropertiesAsInputs_policyNotExist() { Either<List<InputDefinition>, StorageOperationStatus> declareResult = policyPropertyDeclarator.declarePropertiesAsInputs(resource, "nonExistingPolicy", Collections.emptyList()); assertThat(declareResult.right().value()).isEqualTo(StorageOperationStatus.NOT_FOUND); - verifyZeroInteractions(policyOperation); + verifyNoInteractions(policyOperation); } @Test @@ -113,14 +113,14 @@ public class PolicyPropertyDeceleratorTest extends PropertyDeceleratorTestBase{ Resource resource = new Resource(); StorageOperationStatus storageOperationStatus = policyPropertyDeclarator.unDeclarePropertiesAsInputs(resource, input); assertThat(storageOperationStatus).isEqualTo(StorageOperationStatus.OK); - verifyZeroInteractions(policyOperation); + verifyNoInteractions(policyOperation); } @Test public void testUnDeclareProperties_whenNoPropertiesFromPolicyMatchInputId_returnOk() { StorageOperationStatus storageOperationStatus = policyPropertyDeclarator.unDeclarePropertiesAsInputs(createResourceWithPolicy(), input); assertThat(storageOperationStatus).isEqualTo(StorageOperationStatus.OK); - verifyZeroInteractions(policyOperation); + verifyNoInteractions(policyOperation); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclaratorTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclaratorTest.java index c0b176a571..62b28a85e8 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclaratorTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/property/PolicyPropertyDeclaratorTest.java @@ -49,7 +49,7 @@ import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) @@ -83,7 +83,7 @@ public class PolicyPropertyDeclaratorTest extends PropertyDeclaratorTestBase { public void testDeclarePropertiesAsInputs_policyNotExist() { Either<List<InputDefinition>, StorageOperationStatus> declareResult = policyPropertyDeclarator.declarePropertiesAsInputs(resource, "nonExistingPolicy", Collections.emptyList()); assertEquals(StorageOperationStatus.NOT_FOUND, declareResult.right().value()); - verifyZeroInteractions(policyOperation); + verifyNoInteractions(policyOperation); } @Test @@ -110,14 +110,14 @@ public class PolicyPropertyDeclaratorTest extends PropertyDeclaratorTestBase { Resource resource = new Resource(); StorageOperationStatus storageOperationStatus = policyPropertyDeclarator.unDeclarePropertiesAsInputs(resource, input); assertEquals(StorageOperationStatus.OK, storageOperationStatus); - verifyZeroInteractions(policyOperation); + verifyNoInteractions(policyOperation); } @Test public void testUnDeclareProperties_whenNoPropertiesFromPolicyMatchInputId_returnOk() { StorageOperationStatus storageOperationStatus = policyPropertyDeclarator.unDeclarePropertiesAsInputs(createResourceWithPolicy(), input); assertEquals(StorageOperationStatus.OK, storageOperationStatus); - verifyZeroInteractions(policyOperation); + verifyNoInteractions(policyOperation); } @Test @@ -159,14 +159,14 @@ public class PolicyPropertyDeclaratorTest extends PropertyDeclaratorTestBase { Resource resource = new Resource(); StorageOperationStatus storageOperationStatus = policyPropertyDeclarator.unDeclarePropertiesAsListInputs(resource, input); assertEquals(StorageOperationStatus.OK, storageOperationStatus); - verifyZeroInteractions(policyOperation); + verifyNoInteractions(policyOperation); } @Test public void testUnDeclarePropertiesAsListInputs_whenNoPropertiesFromPolicyMatchInputId_returnOk() { StorageOperationStatus storageOperationStatus = policyPropertyDeclarator.unDeclarePropertiesAsListInputs(createResourceWithPolicy(), input); assertEquals(StorageOperationStatus.OK, storageOperationStatus); - verifyZeroInteractions(policyOperation); + verifyNoInteractions(policyOperation); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/scheduledtasks/AsdcComponentsCleanerTaskTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/scheduledtasks/AsdcComponentsCleanerTaskTest.java index 6d51c4dc0f..8d3e2146fb 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/scheduledtasks/AsdcComponentsCleanerTaskTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/scheduledtasks/AsdcComponentsCleanerTaskTest.java @@ -37,7 +37,7 @@ class AsdcComponentsCleanerTaskTest extends BeConfDependentTest { // TODO - remove this setup after migration to Junit5 BeConfDependentTest @BeforeAll - private static void setup() { + static void setup() { configurationManager = new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be")); } diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java index 44e35fca06..0672ec3713 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/validation/ServiceDistributionValidationTest.java @@ -51,7 +51,7 @@ import org.openecomp.sdc.exception.ResponseFormat; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; public class ServiceDistributionValidationTest { @@ -106,7 +106,7 @@ public class ServiceDistributionValidationTest { } catch(ByResponseFormatComponentException e){ assertEquals(errResponse, e.getResponseFormat()); } - verifyZeroInteractions(toscaOperationFacade, operationalEnvironmentDao, componentsUtils); + verifyNoInteractions(toscaOperationFacade, operationalEnvironmentDao, componentsUtils); } @Test @@ -117,7 +117,7 @@ public class ServiceDistributionValidationTest { when(componentsUtils.getResponseFormat(ActionStatus.API_RESOURCE_NOT_FOUND, ApiResourceEnum.SERVICE_ID.getValue())).thenReturn(errResponse); Either<ActivationRequestInformation, ResponseFormat> activateServiceReq = testInstance.validateActivateServiceRequest(SERVICE_ID, ENV_ID, user, new ServiceDistributionReqInfo("distributionData")); assertEquals(errResponse, activateServiceReq.right().value()); - verifyZeroInteractions(operationalEnvironmentDao); + verifyNoInteractions(operationalEnvironmentDao); } @Test @@ -128,7 +128,7 @@ public class ServiceDistributionValidationTest { when(componentsUtils.getResponseFormat(eq(ActionStatus.INVALID_SERVICE_STATE))).thenReturn(errResponse); Either<ActivationRequestInformation, ResponseFormat> activateServiceReq = testInstance.validateActivateServiceRequest(SERVICE_ID, ENV_ID, user, new ServiceDistributionReqInfo("distributionData")); assertEquals(errResponse, activateServiceReq.right().value()); - verifyZeroInteractions(operationalEnvironmentDao); + verifyNoInteractions(operationalEnvironmentDao); } @Test @@ -181,4 +181,4 @@ public class ServiceDistributionValidationTest { assertEquals(service, activateServiceReq.left().value().getServiceToActivate()); assertEquals("context", activateServiceReq.left().value().getWorkloadContext()); } -}
\ No newline at end of file +} diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java index c0d858a4e7..2b790a4137 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/servlets/PolicyServletTest.java @@ -26,6 +26,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyMap; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; import static org.openecomp.sdc.common.api.Constants.GET_POLICY; @@ -293,7 +294,7 @@ class PolicyServletTest extends JerseySpringBaseTest { void getPolicyProperties_wrongComponentType() { Response response = buildGetPropertiesRequest("unknownType").get(); assertThat(response.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode()); - //verifyZeroInteractions(businessLogic); + verifyNoInteractions(businessLogic); } @Test diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtilTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtilTest.java index 3b8089e858..f5758e9d07 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtilTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/utils/ForwardingPathToscaUtilTest.java @@ -50,7 +50,7 @@ import org.openecomp.sdc.common.impl.FSConfigurationSource; import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; @SpringJUnitConfig(locations = "classpath:paths/path-context.xml") -public class ForwardingPathToscaUtilTest extends BaseForwardingPathTest { +class ForwardingPathToscaUtilTest extends BaseForwardingPathTest { private static final String NODE_NAME_1 = "nodeA-name"; private static final String NODE_NAME_2 = "nodeB-name"; @@ -65,13 +65,13 @@ public class ForwardingPathToscaUtilTest extends BaseForwardingPathTest { private Map<String, Component> originComponents = new HashMap<>(); @BeforeAll - private static void setup() { + static void setup() { configurationManager = new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(), "src/test/resources/config/catalog-be")); } @BeforeEach - public void setUpForwardingPath() { + void setUpForwardingPath() { service = initForwardPath(); List<ComponentInstance> componentInstances = new ArrayList<>(); componentInstances.add(generateComponentInstance(NODE_NAME_1, NODE_ID_1)); @@ -101,7 +101,7 @@ public class ForwardingPathToscaUtilTest extends BaseForwardingPathTest { } @Test - public void singleElementPath() { + void singleElementPath() { Assertions.assertDoesNotThrow(() -> { createPathSingleElement(); Map<String, ToscaNodeTemplate> nodeTemplatesRes = new HashMap<>(); diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationTest.java index 1171a88340..7986e59bb5 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/PolicyOperationTest.java @@ -44,7 +44,7 @@ import java.util.Collections; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.verifyNoInteractions; import static org.mockito.Mockito.when; @RunWith(MockitoJUnitRunner.class) @@ -87,7 +87,7 @@ public class PolicyOperationTest { JanusGraphOperationStatus.NOT_FOUND)); StorageOperationStatus storageOperationStatus = testInstance.updatePolicyProperties(component, POLICY_ID, Collections.emptyList()); assertThat(storageOperationStatus).isEqualTo(StorageOperationStatus.NOT_FOUND); - verifyZeroInteractions(topologyTemplateOperation); + verifyNoInteractions(topologyTemplateOperation); } @Test diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java index 6ef4a61fcd..c970987ce5 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/operations/impl/ComponentInstanceOperationTest.java @@ -29,8 +29,16 @@ */ package org.openecomp.sdc.be.model.operations.impl; -import org.janusgraph.core.JanusGraphVertex; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + import fj.data.Either; +import java.util.ArrayList; +import java.util.List; +import org.janusgraph.core.JanusGraphVertex; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; @@ -47,56 +55,48 @@ import org.openecomp.sdc.be.model.GroupInstance; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.resources.data.ComponentInstanceData; -import java.util.ArrayList; -import java.util.List; - -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.anyObject; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.when; - @RunWith(MockitoJUnitRunner.class) public class ComponentInstanceOperationTest { - @InjectMocks - private ComponentInstanceOperation componentInstanceOperation; - - @Mock - protected HealingJanusGraphGenericDao janusGraphGenericDao; - - - @Test - public void testSetJanusGraphGenericDao() { - componentInstanceOperation.setJanusGraphGenericDao(janusGraphGenericDao); - } - - - @Test - public void testUpdateInputValueInResourceInstance() { - ComponentInstanceInput input = null; - String resourceInstanceId = ""; - boolean b = false; - Either<ComponentInstanceInput, StorageOperationStatus> result; - - result = componentInstanceOperation.updateInputValueInResourceInstance(input, resourceInstanceId, b); - assertNull(result); - } - - @Test - public void testUpdateCustomizationUUID() { - StorageOperationStatus result; - String componentInstanceId = "instanceId"; - JanusGraphVertex janusGraphVertex = Mockito.mock(JanusGraphVertex.class); - when(janusGraphGenericDao.getVertexByProperty(GraphPropertiesDictionary.UNIQUE_ID.getProperty(),componentInstanceId)).thenReturn(Either.left(janusGraphVertex)); - result = componentInstanceOperation.updateCustomizationUUID(componentInstanceId); - assertEquals(StorageOperationStatus.OK, result); - } - - @Test - public void testupdateComponentInstanceModificationTimeAndCustomizationUuidOnGraph_CatchException() throws Exception { + @InjectMocks + private ComponentInstanceOperation componentInstanceOperation; + + @Mock + protected HealingJanusGraphGenericDao janusGraphGenericDao; + + + @Test + public void testSetJanusGraphGenericDao() { + componentInstanceOperation.setJanusGraphGenericDao(janusGraphGenericDao); + } + + + @Test + public void testUpdateInputValueInResourceInstance() { + ComponentInstanceInput input = null; + String resourceInstanceId = ""; + boolean b = false; + Either<ComponentInstanceInput, StorageOperationStatus> result; + + result = componentInstanceOperation.updateInputValueInResourceInstance(input, resourceInstanceId, b); + assertNull(result); + } + + @Test + public void testUpdateCustomizationUUID() { + StorageOperationStatus result; + String componentInstanceId = "instanceId"; + JanusGraphVertex janusGraphVertex = Mockito.mock(JanusGraphVertex.class); + when(janusGraphGenericDao.getVertexByProperty(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), componentInstanceId)).thenReturn( + Either.left(janusGraphVertex)); + result = componentInstanceOperation.updateCustomizationUUID(componentInstanceId); + assertEquals(StorageOperationStatus.OK, result); + } + + @Test + public void testupdateComponentInstanceModificationTimeAndCustomizationUuidOnGraph_CatchException() throws Exception { ComponentInstance componentInstance = new ComponentInstance(); - GroupInstance groupInstance=new GroupInstance(); + GroupInstance groupInstance = new GroupInstance(); groupInstance.setCreationTime(23234234234L); groupInstance.setCustomizationUUID("CUSTUUID0.1"); groupInstance.setGroupUid("GRP0.1"); @@ -107,14 +107,15 @@ public class ComponentInstanceOperationTest { componentInstance.setUniqueId("INST0.1"); componentInstance.setComponentUid("RES0.1"); componentInstance.setGroupInstances(gilist); - Either<ComponentInstanceData, StorageOperationStatus> result = componentInstanceOperation.updateComponentInstanceModificationTimeAndCustomizationUuidOnGraph(componentInstance, NodeTypeEnum.Component,234234545L,false); + Either<ComponentInstanceData, StorageOperationStatus> result = componentInstanceOperation.updateComponentInstanceModificationTimeAndCustomizationUuidOnGraph( + componentInstance, NodeTypeEnum.Component, 234234545L, false); assertEquals(StorageOperationStatus.GENERAL_ERROR, result.right().value()); - } + } @Test public void testupdateComponentInstanceModificationTimeAndCustomizationUuidOnGraph_GENERAL_ERROR() throws Exception { ComponentInstance componentInstance = new ComponentInstance(); - GroupInstance groupInstance=new GroupInstance(); + GroupInstance groupInstance = new GroupInstance(); groupInstance.setCreationTime(23234234234L); groupInstance.setCustomizationUUID("CUSTUUID0.1"); groupInstance.setGroupUid("GRP0.1"); @@ -125,16 +126,17 @@ public class ComponentInstanceOperationTest { componentInstance.setUniqueId("INST0.1"); componentInstance.setComponentUid("RES0.1"); componentInstance.setGroupInstances(gilist); - when(janusGraphGenericDao.updateNode(anyObject(),eq(ComponentInstanceData.class))).thenReturn(Either.right( + when(janusGraphGenericDao.updateNode(any(), eq(ComponentInstanceData.class))).thenReturn(Either.right( JanusGraphOperationStatus.GENERAL_ERROR)); - Either<ComponentInstanceData, StorageOperationStatus> result = componentInstanceOperation.updateComponentInstanceModificationTimeAndCustomizationUuidOnGraph(componentInstance, NodeTypeEnum.Component,234234545L,false); + Either<ComponentInstanceData, StorageOperationStatus> result = componentInstanceOperation.updateComponentInstanceModificationTimeAndCustomizationUuidOnGraph( + componentInstance, NodeTypeEnum.Component, 234234545L, false); assertEquals(StorageOperationStatus.GENERAL_ERROR, result.right().value()); } @Test public void testupdateComponentInstanceModificationTimeAndCustomizationUuidOnGraph() throws Exception { ComponentInstance componentInstance = new ComponentInstance(); - GroupInstance groupInstance=new GroupInstance(); + GroupInstance groupInstance = new GroupInstance(); groupInstance.setCreationTime(23234234234L); groupInstance.setCustomizationUUID("CUSTUUID0.1"); groupInstance.setGroupUid("GRP0.1"); @@ -146,9 +148,10 @@ public class ComponentInstanceOperationTest { componentInstance.setComponentUid("RES0.1"); componentInstance.setGroupInstances(gilist); ComponentInstanceData componentInstanceData = new ComponentInstanceData(); - when(janusGraphGenericDao.updateNode(anyObject(),eq(ComponentInstanceData.class))).thenReturn(Either.left(componentInstanceData)); - Either<ComponentInstanceData, StorageOperationStatus> result = componentInstanceOperation.updateComponentInstanceModificationTimeAndCustomizationUuidOnGraph(componentInstance, NodeTypeEnum.Component,234234545L,false); + when(janusGraphGenericDao.updateNode(any(), eq(ComponentInstanceData.class))).thenReturn(Either.left(componentInstanceData)); + Either<ComponentInstanceData, StorageOperationStatus> result = componentInstanceOperation.updateComponentInstanceModificationTimeAndCustomizationUuidOnGraph( + componentInstance, NodeTypeEnum.Component, 234234545L, false); assertEquals(componentInstanceData, result.left().value()); } - + } diff --git a/openecomp-be/backend/openecomp-sdc-action-manager/src/test/java/org/openecomp/sdc/action/impl/ActionManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-action-manager/src/test/java/org/openecomp/sdc/action/impl/ActionManagerImplTest.java index a2038206c2..db2a0df576 100644 --- a/openecomp-be/backend/openecomp-sdc-action-manager/src/test/java/org/openecomp/sdc/action/impl/ActionManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-action-manager/src/test/java/org/openecomp/sdc/action/impl/ActionManagerImplTest.java @@ -22,11 +22,10 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.openecomp.core.dao.UniqueValueDao; import org.openecomp.sdc.action.ActionConstants; import org.openecomp.sdc.action.dao.ActionArtifactDao; @@ -55,9 +54,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.when; @@ -113,7 +112,7 @@ public class ActionManagerImplTest { @Test public void testGetFilteredActionsShouldPassForFilterTypeName() { - Mockito.when(actionDao.getFilteredActions(Matchers.anyString(), Matchers.anyString())) + Mockito.when(actionDao.getFilteredActions(anyString(), anyString())) .thenReturn(mockActionsToReturn()); List<Action> actions = actionManager.getFilteredActions("NAME", ActionConstants.FILTER_TYPE_NAME ); Assert.assertEquals(1, actions.size()); @@ -121,37 +120,37 @@ public class ActionManagerImplTest { @Test(expected = ActionException.class) public void testGetFilteredActionsShouldThrowExceptionForFilterTypeNameWhenReturnedActionsOrEmptyOrNull() { - Mockito.when(actionDao.getFilteredActions(Matchers.anyString(), Matchers.anyString())) + Mockito.when(actionDao.getFilteredActions(anyString(), anyString())) .thenReturn(new ArrayList<>()); actionManager.getFilteredActions("NAME", ActionConstants.FILTER_TYPE_NAME ); } @Test public void testGetFilteredActionsByMajorMinorVersionShouldPassWithActiveVersion() { - Mockito.when(actionDao.getFilteredActions(Matchers.anyString(), Matchers.anyString())) + Mockito.when(actionDao.getFilteredActions(anyString(), anyString())) .thenReturn(mockActionsToReturn()); Map<String, VersionInfo> actionVersionMap = new HashMap<>(); VersionInfo versionInfo = createVersionInfo(); actionVersionMap.put("uuid", versionInfo); - Mockito.when(versioningManager.listEntitiesVersionInfo(Matchers.anyString(), - Matchers.anyString(), Matchers.any())).thenReturn(actionVersionMap); + Mockito.when(versioningManager.listEntitiesVersionInfo(anyString(), + anyString(), any())).thenReturn(actionVersionMap); List<Action> actions = actionManager.getFilteredActions("type", ActionConstants.FILTER_TYPE_NAME ); Assert.assertEquals(1, actions.size()); } @Test public void testGetFilteredActionsByMajorMinorVersionShouldPassWithLatestFinalVersion() { - Mockito.when(actionDao.getFilteredActions(Matchers.anyString(), Matchers.anyString())) + Mockito.when(actionDao.getFilteredActions(anyString(), anyString())) .thenReturn(mockActionsToReturn()); Map<String, VersionInfo> actionVersionMap = new HashMap<>(); VersionInfo versionInfo = createVersionInfo(); actionVersionMap.put("uuid", versionInfo); - Mockito.when(versioningManager.listEntitiesVersionInfo(Matchers.anyString(), - Matchers.anyString(), Matchers.any())).thenReturn(actionVersionMap); + Mockito.when(versioningManager.listEntitiesVersionInfo(anyString(), + anyString(), any())).thenReturn(actionVersionMap); List<Action> actions = actionManager.getFilteredActions("type", ActionConstants.FILTER_TYPE_NAME ); Assert.assertEquals(1, actions.size()); } @@ -232,7 +231,7 @@ public class ActionManagerImplTest { Mockito.when(versioningManager.checkout(anyString(), anyString(),anyString())).thenReturn(createVersion()); Action action = actionManager.checkout(invariantUuId, "user"); Assert.assertNotNull(action); - Mockito.verify(actionDao, times(1)).update(Matchers.any(ActionEntity.class)); + Mockito.verify(actionDao, times(1)).update(any(ActionEntity.class)); } @@ -270,16 +269,16 @@ public class ActionManagerImplTest { @Test public void testCheckinShouldPassForHappyScenario() { - when(versioningManager.checkin(anyString(), anyString(), anyString(), Matchers.any())) + when(versioningManager.checkin(anyString(), anyString(), anyString(), any())) .thenReturn(createVersion()); when(actionDao.get(any(ActionEntity.class))).thenReturn(createActionEntity()); Assert.assertNotNull(actionManager.checkin("invariantUuid", "user")); - Mockito.verify(actionDao, times(1)).update(Matchers.any(ActionEntity.class)); + Mockito.verify(actionDao, times(1)).update(any(ActionEntity.class)); } @Test(expected = ActionException.class) public void testCheckinShouldShouldThrowExceptionInCaseOfAnyException() { - when(versioningManager.checkin(anyString(), anyString(), anyString(), Matchers.any())) + when(versioningManager.checkin(anyString(), anyString(), anyString(), any())) .thenThrow((new CoreException(new ErrorCode.ErrorCodeBuilder() .withId(VersioningErrorCodes.CHECKIN_ON_UNLOCKED_ENTITY).build()))); actionManager.checkin("invariantUuid", "user"); @@ -287,18 +286,18 @@ public class ActionManagerImplTest { @Test public void testSubmitShouldPassForHappyScenario() { - when(versioningManager.submit(anyString(), anyString(), anyString(), Matchers.any())) + when(versioningManager.submit(anyString(), anyString(), anyString(), any())) .thenReturn(createVersion()); when(actionDao.get(any(ActionEntity.class))).thenReturn(createActionEntity()); Assert.assertNotNull( actionManager.submit("invariantUuid", "user")); - Mockito.verify(actionDao, times(1)).update(Matchers.any(ActionEntity.class)); + Mockito.verify(actionDao, times(1)).update(any(ActionEntity.class)); } @Test(expected = ActionException.class) public void testSubmitShouldThrowExceptionForAnyException() { - when(versioningManager.submit(anyString(), anyString(), anyString(), Matchers.any())) + when(versioningManager.submit(anyString(), anyString(), anyString(), any())) .thenThrow((new CoreException(new ErrorCode.ErrorCodeBuilder() .withId(VersioningErrorCodes.SUBMIT_FINALIZED_ENTITY_NOT_ALLOWED).build()))); actionManager.submit("invariantUuid", "user"); diff --git a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImplTest.java index eb7afd6d1b..1b53266033 100644 --- a/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImplTest.java +++ b/openecomp-be/backend/openecomp-sdc-item-permissions-manager/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsManagerImplTest.java @@ -18,6 +18,7 @@ package org.openecomp.sdc.itempermissions.dao.impl; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; import static org.openecomp.sdc.itempermissions.notifications.NotificationConstants.ITEM_ID_PROP; @@ -38,7 +39,6 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.InjectMocks; -import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.junit.jupiter.MockitoExtension; @@ -133,7 +133,7 @@ class PermissionsManagerImplTest { } private void verifyDirectNotificationCallParameters(String affectedUser, boolean permissionGranted) { - verify(notifierMock).directNotification(eventArgumentCaptor.capture(), Matchers.eq(affectedUser)); + verify(notifierMock).directNotification(eventArgumentCaptor.capture(), eq(affectedUser)); Event event = eventArgumentCaptor.getValue(); assertTrue(event.getEventType().equals(PERMISSION_CHANGED)); Map<String, Object> attributes = event.getAttributes(); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java index 52923877cf..046948223c 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/LimitTest.java @@ -40,7 +40,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; @@ -102,9 +102,9 @@ public class LimitTest { info.getViewableVersions().add(version); info.setActiveVersion(version); - /*doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(), anyObject(), anyObject());*/ - doReturn(true).when(limitDao).isLimitPresent(anyObject()); - doReturn(limitEntity1).when(limitDao).get(anyObject()); + /*doReturn(info).when(vendorLicenseFacade).getVersionInfo(any(), any(), any());*/ + doReturn(true).when(limitDao).isLimitPresent(any()); + doReturn(limitEntity1).when(limitDao).get(any()); List<LimitEntity> limitEntityList = new ArrayList<>(); limitEntityList.add(limitEntity1); @@ -112,11 +112,11 @@ public class LimitTest { limitEntity1.setId("1234"); limitEntity2.setId("1234"); doReturn(limitEntityList).when(vendorLicenseFacade) - .listLimits(anyObject(), anyObject(), anyObject()); + .listLimits(any(), any(), any()); vendorLicenseManagerImpl.updateLimit(limitEntity2); - verify(vendorLicenseFacade).updateLimit(anyObject()); + verify(vendorLicenseFacade).updateLimit(any()); } @Test @@ -132,8 +132,8 @@ public class LimitTest { info.setActiveVersion(version); /* doReturn(info).when(vendorLicenseFacade) - .getVersionInfo(anyObject(), anyObject(), anyObject());*/ - doReturn(limitEntity1).when(limitDao).get(anyObject()); + .getVersionInfo(any(), any(), any());*/ + doReturn(limitEntity1).when(limitDao).get(any()); List<LimitEntity> limitEntityList = new ArrayList<>(); limitEntityList.add(limitEntity1); @@ -141,7 +141,7 @@ public class LimitTest { limitEntity1.setId("1234"); limitEntity2.setId("9632"); doReturn(limitEntityList).when(vendorLicenseFacade) - .listLimits(anyObject(), anyObject(), anyObject()); + .listLimits(any(), any(), any()); vendorLicenseManagerImpl.updateLimit(limitEntity2); Assert.fail(); @@ -160,9 +160,9 @@ public class LimitTest { info.getViewableVersions().add(version); info.setActiveVersion(version); - /*doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(), anyObject(), anyObject());*/ - doReturn(true).when(limitDao).isLimitPresent(anyObject()); - doReturn(limitEntity).when(limitDao).get(anyObject()); + /*doReturn(info).when(vendorLicenseFacade).getVersionInfo(any(), any(), any());*/ + doReturn(true).when(limitDao).isLimitPresent(any()); + doReturn(limitEntity).when(limitDao).get(any()); List<LimitEntity> limitEntityList = new ArrayList<>(); limitEntityList.add(limitEntity); @@ -170,7 +170,7 @@ public class LimitTest { vendorLicenseManagerImpl.deleteLimit(limitEntity); - verify(vendorLicenseManagerImpl).deleteLimit(anyObject()); + verify(vendorLicenseManagerImpl).deleteLimit(any()); } @Test @@ -186,8 +186,8 @@ public class LimitTest { info.setActiveVersion(version); /* doReturn(info).when(vendorLicenseFacade) - .getVersionInfo(anyObject(), anyObject(), anyObject());*/ - doReturn(null).when(limitDao).get(anyObject()); + .getVersionInfo(any(), any(), any());*/ + doReturn(null).when(limitDao).get(any()); vendorLicenseManagerImpl.updateLimit(limitEntity2); Assert.fail(); @@ -220,7 +220,7 @@ public class LimitTest { info.getViewableVersions().add(VERSION); info.setActiveVersion(VERSION); - /*doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(), anyObject(), anyObject());*/ + /*doReturn(info).when(vendorLicenseFacade).getVersionInfo(any(), any(), any());*/ vendorLicenseManagerImpl.createLimit(expected); verify(vendorLicenseFacade).createLimit(expected); @@ -238,13 +238,13 @@ public class LimitTest { List<LimitEntity> vfcImageList = new ArrayList<LimitEntity>(); vfcImageList.add(expectedDiffName); doReturn(vfcImageList).when(vendorLicenseFacade) - .listLimits(anyObject(), anyObject(), anyObject()); + .listLimits(any(), any(), any()); VersionInfo info = new VersionInfo(); info.getViewableVersions().add(VERSION); info.setActiveVersion(VERSION); -/* doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(), anyObject(), anyObject());*/ +/* doReturn(info).when(vendorLicenseFacade).getVersionInfo(any(), any(), any());*/ try { vendorLicenseManagerImpl.createLimit(expected); @@ -262,7 +262,7 @@ public class LimitTest { info.getViewableVersions().add(VERSION); info.setActiveVersion(VERSION); - /*doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(), anyObject(), anyObject());*/ + /*doReturn(info).when(vendorLicenseFacade).getVersionInfo(any(), any(), any());*/ try { vendorLicenseManagerImpl.getLimit(limit); @@ -283,13 +283,13 @@ public class LimitTest { expected.setMetric("BWTH"); expected.setTime("Day"); - doReturn(true).when(limitDao).isLimitPresent(anyObject()); - doReturn(expected).when(limitDao).get(anyObject()); + doReturn(true).when(limitDao).isLimitPresent(any()); + doReturn(expected).when(limitDao).get(any()); VersionInfo info = new VersionInfo(); info.getViewableVersions().add(VERSION); info.setActiveVersion(VERSION); - /*doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(), anyObject(), anyObject());*/ + /*doReturn(info).when(vendorLicenseFacade).getVersionInfo(any(), any(), any());*/ LimitEntity actual = createLimit(VLM_ID, VERSION, EPLKG_ID, LIMIT1_ID); vendorLicenseManagerImpl.getLimit(actual); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java index 253337dc83..ef2910c4fd 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/FeatureGroupTest.java @@ -37,7 +37,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; public class FeatureGroupTest { @@ -137,11 +137,11 @@ public class FeatureGroupTest { "partNumber", "MRN", licenseKeyGroupIds, entitlementPoolIds, referencingLicenseAgreements); - doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject()); + doReturn(featureGroupEntity).when(featureGroupDao).get(any()); /*if(featureGroupEntity.getManufacturerReferenceNumber() != null) featureGroupDao.update(featureGroupEntity); - verify(featureGroupDao).update(anyObject());*/ + verify(featureGroupDao).update(any());*/ } @Test @@ -163,11 +163,11 @@ public class FeatureGroupTest { "partNumber", null, licenseKeyGroupIds, entitlementPoolIds, referencingLicenseAgreements); - doReturn(featureGroupEntity).when(featureGroupDao).get(anyObject()); + doReturn(featureGroupEntity).when(featureGroupDao).get(any()); /*if(featureGroupEntity.getManufacturerReferenceNumber() != null) featureGroupDao.update(featureGroupEntity); - verify(featureGroupDao, never()).update(anyObject());*/ + verify(featureGroupDao, never()).update(any());*/ } @Test @@ -230,8 +230,8 @@ public class FeatureGroupTest { doReturn(lkg1).when(licenseKeyGroupDao).get(lkg1); doReturn(lkg2).when(licenseKeyGroupDao).get(lkg2); - doNothing().when(vendorLicenseManagerImpl).updateUniqueName(anyObject(), anyObject(), - anyObject(), anyObject(), anyObject()); + doNothing().when(vendorLicenseManagerImpl).updateUniqueName(any(), any(), + any(), any(), any()); vendorLicenseManagerImpl.updateFeatureGroup(existingFG, addedLKGs, removedLKGs, addedEPs, removedEPs); @@ -255,7 +255,7 @@ public class FeatureGroupTest { existingFG.setEntitlementPoolIds(new HashSet<String>()); existingFG.setLicenseKeyGroupIds(new HashSet<String>()); - doReturn(existingFG).when(featureGroupDao).get(anyObject()); + doReturn(existingFG).when(featureGroupDao).get(any()); Set<String> removedEPs = new HashSet<>(); Set<String> addedEPs = new HashSet<>(); @@ -277,8 +277,8 @@ public class FeatureGroupTest { doReturn(lkg1).when(licenseKeyGroupDao).get(lkg1); doReturn(lkg2).when(licenseKeyGroupDao).get(lkg2); - doNothing().when(vendorLicenseManagerImpl).updateUniqueName(anyObject(), anyObject(), - anyObject(),anyObject(), anyObject()); + doNothing().when(vendorLicenseManagerImpl).updateUniqueName(any(), any(), + any(),any(), any()); FeatureGroupEntity fg = new FeatureGroupEntity(vlm1_id, VERSION01, fg1_id); @@ -306,7 +306,7 @@ public class FeatureGroupTest { existingFG.setEntitlementPoolIds(epSet); existingFG.setLicenseKeyGroupIds(lkgSet); - doReturn(existingFG).when(featureGroupDao).get(anyObject()); + doReturn(existingFG).when(featureGroupDao).get(any()); EntitlementPoolEntity ep1 = new EntitlementPoolEntity(vlm1_id, VERSION01, ep1_id); doReturn(ep1).when(entitlementPoolDao).get(ep1); @@ -319,8 +319,8 @@ public class FeatureGroupTest { Set<String> removedLKGs = new HashSet<>(); Set<String> addedLKGs = new HashSet<>(); - doNothing().when(vendorLicenseManagerImpl).updateUniqueName(anyObject(), anyObject(), - anyObject(),anyObject(), anyObject()); + doNothing().when(vendorLicenseManagerImpl).updateUniqueName(any(), any(), + any(),any(), any()); FeatureGroupEntity fg = new FeatureGroupEntity(vlm1_id, VERSION01, fg1_id); @@ -357,7 +357,7 @@ public class FeatureGroupTest { existingFG.setEntitlementPoolIds(new HashSet<String>()); existingFG.setLicenseKeyGroupIds(new HashSet<String>()); - doReturn(existingFG).when(featureGroupDao).get(anyObject()); + doReturn(existingFG).when(featureGroupDao).get(any()); doNothing().when(vendorLicenseManagerImpl).deleteUniqueName(VendorLicenseConstants .UniqueValues.FEATURE_GROUP_NAME, vlm1_id, VERSION01.toString(), existingFG.getName()); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java index 4e5045256c..78b4e0dc94 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseAgreementTest.java @@ -37,7 +37,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; public class LicenseAgreementTest { @@ -195,8 +195,8 @@ public class LicenseAgreementTest { FeatureGroupEntity fg2 = new FeatureGroupEntity(vlm1_id, VERSION01, fg2_id); doReturn(fg1).when(featureGroupDaoMcok).get(fg1); doReturn(fg2).when(featureGroupDaoMcok).get(fg2); - doNothing().when(vendorLicenseManager).updateUniqueName(anyObject(), anyObject(), anyObject(), - anyObject(), anyObject()); + doNothing().when(vendorLicenseManager).updateUniqueName(any(), any(), any(), + any(), any()); vendorLicenseManager.updateLicenseAgreement(existingLA, addedFGs, removedFGs); @@ -213,7 +213,7 @@ public class LicenseAgreementTest { existingLA.setName("LA"); existingLA.setFeatureGroupIds(new HashSet<>()); - doReturn(existingLA).when(licenseAgreementDaoMcok).get(anyObject()); + doReturn(existingLA).when(licenseAgreementDaoMcok).get(any()); doNothing().when(vendorLicenseManager).deleteUniqueName(VendorLicenseConstants.UniqueValues .LICENSE_AGREEMENT_NAME, vlm1_id, VERSION01.toString(), existingLA.getName()); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java index 96e78a450c..c7be4a933c 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/LicenseKeyGroupTest.java @@ -42,7 +42,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Set; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; public class LicenseKeyGroupTest { @@ -108,7 +108,7 @@ public class LicenseKeyGroupTest { Version version = new Version(); info.getViewableVersions().add(version); info.setActiveVersion(version); - doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject()); + doReturn(info).when(vendorLicenseFacade).getVersionInfo(any(),any(),any()); LimitEntity limitEntity = LimitTest.createLimitEntity(LT_NAME,LimitType.Vendor,"string",version, "Core",AggregationFunction.Average,10,"Hour"); @@ -116,10 +116,10 @@ public class LicenseKeyGroupTest { ArrayList<LimitEntity> limitEntityList = new ArrayList(); limitEntityList.add(limitEntity); - doReturn(licenseKeyGroup).when(licenseKeyGroupDao).get(anyObject()); - doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(anyObject(), anyObject(), anyObject(), anyObject()); - doReturn(true).when(limitDao).isLimitPresent(anyObject()); - doReturn(limitEntity).when(limitDao).get(anyObject()); + doReturn(licenseKeyGroup).when(licenseKeyGroupDao).get(any()); + doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(any(), any(), any(), any()); + doReturn(true).when(limitDao).isLimitPresent(any()); + doReturn(limitEntity).when(limitDao).get(any()); try { Field limitField = VendorLicenseManagerImpl.class.getDeclaredField("limitDao"); limitField.setAccessible(true); @@ -141,7 +141,7 @@ public class LicenseKeyGroupTest { vendorLicenseManagerImpl.deleteLicenseKeyGroup(licenseKeyGroup, USER); - verify(limitDao).delete(anyObject()); + verify(limitDao).delete(any()); } @Test @@ -160,7 +160,7 @@ public class LicenseKeyGroupTest { Version version = new Version(); info.getViewableVersions().add(version); info.setActiveVersion(version); - doReturn(info).when(vendorLicenseFacade).getVersionInfo(anyObject(),anyObject(),anyObject()); + doReturn(info).when(vendorLicenseFacade).getVersionInfo(any(),any(),any()); LimitEntity limitEntity = LimitTest.createLimitEntity(LT_NAME,LimitType.Vendor,"string",version, "Core",AggregationFunction.Average,10,"Hour"); @@ -168,9 +168,9 @@ public class LicenseKeyGroupTest { ArrayList<LimitEntity> limitEntityList = new ArrayList(); limitEntityList.add(limitEntity); - doReturn(licenseKeyGroup).when(licenseKeyGroupDao).get(anyObject()); - doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(anyObject(), anyObject(), anyObject(), anyObject()); - doReturn(false).when(limitDao).isLimitPresent(anyObject()); + doReturn(licenseKeyGroup).when(licenseKeyGroupDao).get(any()); + doReturn(limitEntityList).when(vendorLicenseFacade).listLimits(any(), any(), any(), any()); + doReturn(false).when(limitDao).isLimitPresent(any()); try { Field limitField = VendorLicenseManagerImpl.class.getDeclaredField("limitDao"); @@ -411,7 +411,7 @@ public class LicenseKeyGroupTest { LicenseKeyGroupEntity lkg = createLicenseKeyGroup(vlm1_id, VERSION01, lkg1_id, LKG1_NAME, "LKG1 dec", LicenseKeyType.Universal, multiChoiceOrOther); - doReturn(lkg).when(licenseKeyGroupDao).get(anyObject()); + doReturn(lkg).when(licenseKeyGroupDao).get(any()); LicenseKeyGroupEntity lkgRetrived = vendorLicenseManagerImpl.getLicenseKeyGroup(lkg); verify(licenseKeyGroupDao).get(lkg); @@ -438,12 +438,12 @@ public class LicenseKeyGroupTest { lkg.setReferencingFeatureGroups(new HashSet<>()); - doReturn(lkg).when(licenseKeyGroupDao).get(anyObject()); + doReturn(lkg).when(licenseKeyGroupDao).get(any()); doNothing().when(vendorLicenseManagerImpl).deleteChildLimits(vlm1_id, VERSION01, lkg1_id); - doNothing().when(vendorLicenseManagerImpl).deleteUniqueName(anyObject(), anyObject(), - anyObject(), anyObject()); + doNothing().when(vendorLicenseManagerImpl).deleteUniqueName(any(), any(), + any(), any()); vendorLicenseManagerImpl.deleteLicenseKeyGroup(lkg); diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java index 30c1c03322..7b0216d5b6 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseModelTest.java @@ -40,7 +40,7 @@ import java.util.Set; import java.util.List; import java.util.ArrayList; import java.util.HashSet; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImplTest.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImplTest.java index 2d6df03dfe..8017643390 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImplTest.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-core/src/test/java/org/openecomp/sdc/itempermissions/dao/impl/PermissionsServicesImplTest.java @@ -16,8 +16,8 @@ package org.openecomp.sdc.itempermissions.dao.impl; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -127,7 +127,7 @@ public class PermissionsServicesImplTest { public void testListItemPermissions() { doReturn(Arrays.asList(createPermissionEntity(ITEM1_ID, USER1_ID, PERMISSION), createPermissionEntity(ITEM1_ID, USER2_ID, PERMISSION))).when(permissionsDaoMock) - .listItemPermissions(anyObject()); + .listItemPermissions(any()); Collection<ItemPermissionsEntity> actual = permissionsServices.listItemPermissions(ITEM1_ID); Assert.assertEquals(2, actual.size()); diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java index 85b8a4085b..f837f25398 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java @@ -20,7 +20,7 @@ package org.openecomp.sdc.enrichment.impl.external.artifact; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.times; @@ -131,7 +131,7 @@ public class MonitoringMibEnricherTest { "pd_server")); returnedComponents.add(getComponentEntity(vspId, version, componentId2, "pd_server")); - Mockito.when(componentDaoMock.list(anyObject())) + Mockito.when(componentDaoMock.list(any())) .thenReturn(returnedComponents); setMockToEnrichComponent(vspId, version, componentId1); @@ -166,9 +166,9 @@ public class MonitoringMibEnricherTest { returnedArtifact.setArtifactName("mib.zip"); returnedArtifact.setArtifact(getMibByteBuffer("/mock/enrichMib/MIB.zip")); - Mockito.when(componentArtifactDaoMock.getByType(anyObject())) + Mockito.when(componentArtifactDaoMock.getByType(any())) .thenReturn(Optional.of(returnedArtifact)); - Mockito.doNothing().when(enrichedServiceModelDaoMock).storeExternalArtifact(anyObject()); + Mockito.doNothing().when(enrichedServiceModelDaoMock).storeExternalArtifact(any()); } private ComponentEntity getComponentEntity(String vspId, diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java index 9edac107b0..706e189b69 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java @@ -16,7 +16,7 @@ package org.openecomp.sdc.enrichment.impl.external.artifact; -import static org.mockito.Matchers.anyObject; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.never; import static org.mockito.Mockito.when; @@ -81,13 +81,13 @@ public class ProcessArtifactEnricherTest { Collection<ComponentEntity> componentList = new ArrayList<>(); componentList.add(componentEntity); - when(componentDaoMock.list(anyObject())).thenReturn(componentList); + when(componentDaoMock.list(any())).thenReturn(componentList); Collection<ProcessEntity> list = new ArrayList<>(); list.add(processEntity); when(processDaoMock.list(entity)).thenReturn(list); - when(processDaoMock.getArtifact(anyObject())).thenReturn(processEntity); + when(processDaoMock.getArtifact(any())).thenReturn(processEntity); EnrichmentInfo info = new EnrichmentInfo(); info.setVersion(version); @@ -129,13 +129,13 @@ public class ProcessArtifactEnricherTest { Collection<ComponentEntity> componentList = new ArrayList<>(); componentList.add(componentEntity); - when(componentDaoMock.list(anyObject())).thenReturn(componentList); + when(componentDaoMock.list(any())).thenReturn(componentList); Collection<ProcessEntity> list = new ArrayList<>(); list.add(processEntity); when(processDaoMock.list(entity)).thenReturn(list); - when(processDaoMock.getArtifact(anyObject())).thenReturn(processEntity); + when(processDaoMock.getArtifact(any())).thenReturn(processEntity); EnrichmentInfo info = new EnrichmentInfo(); info.setVersion(version); @@ -171,13 +171,13 @@ public class ProcessArtifactEnricherTest { Collection<ComponentEntity> componentList = new ArrayList<>(); componentList.add(componentEntity); - when(componentDaoMock.list(anyObject())).thenReturn(componentList); + when(componentDaoMock.list(any())).thenReturn(componentList); Collection<ProcessEntity> list = new ArrayList<>(); list.add(processEntity); when(processDaoMock.list(entity)).thenReturn(list); - when(processDaoMock.getArtifact(anyObject())).thenReturn(null); + when(processDaoMock.getArtifact(any())).thenReturn(null); EnrichmentInfo info = new EnrichmentInfo(); info.setVersion(version); @@ -211,13 +211,13 @@ public class ProcessArtifactEnricherTest { Collection<ComponentEntity> componentList = new ArrayList<>(); componentList.add(componentEntity); - when(componentDaoMock.list(anyObject())).thenReturn(componentList); + when(componentDaoMock.list(any())).thenReturn(componentList); Collection<ProcessEntity> list = new ArrayList<>(); list.add(processEntity); when(processDaoMock.list(entity)).thenReturn(list); - when(processDaoMock.getArtifact(anyObject())).thenReturn(processEntity); + when(processDaoMock.getArtifact(any())).thenReturn(processEntity); EnrichmentInfo info = new EnrichmentInfo(); info.setVersion(version); diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/destinationprovider/impl/MulticastDestinationTest.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/destinationprovider/impl/MulticastDestinationTest.java index 78265769e5..a71b1645f7 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/destinationprovider/impl/MulticastDestinationTest.java +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/destinationprovider/impl/MulticastDestinationTest.java @@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; /** diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/notification/services/impl/NotificationPropagationManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/notification/services/impl/NotificationPropagationManagerImplTest.java index 2a98953408..b222af8968 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/notification/services/impl/NotificationPropagationManagerImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/notification/services/impl/NotificationPropagationManagerImplTest.java @@ -31,6 +31,7 @@ import org.openecomp.sdc.notification.dtos.Event; import org.openecomp.sdc.notification.services.PropagationService; import org.openecomp.sdc.notification.services.SubscriptionService; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; @@ -61,7 +62,7 @@ public class NotificationPropagationManagerImplTest { public void shouldCallPropagationServiceNotifyWithMulticastDestinationWhenNotifySubscribers() throws Exception { notificationPropagationManager.notifySubscribers(eventMock); - verify(propagationServiceMock).notify(Matchers.eq(eventMock), destinationProviderCaptor + verify(propagationServiceMock).notify(eq(eventMock), destinationProviderCaptor .capture()); Assert.assertTrue(destinationProviderCaptor.getValue() instanceof MulticastDestination); @@ -71,7 +72,7 @@ public class NotificationPropagationManagerImplTest { public void shouldCallPropagationServiceNotifyWithUnicastDestinationWhenDirectNotification() throws Exception { notificationPropagationManager.directNotification(eventMock, "aaa"); - verify(propagationServiceMock).notify(Matchers.eq(eventMock), destinationProviderCaptor + verify(propagationServiceMock).notify(eq(eventMock), destinationProviderCaptor .capture()); Assert.assertTrue(destinationProviderCaptor.getValue() instanceof UnicastDestination); } diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/notification/services/impl/NotificationsServiceImplTest.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/notification/services/impl/NotificationsServiceImplTest.java index 1625156c3c..f893983e5f 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/notification/services/impl/NotificationsServiceImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/notification/services/impl/NotificationsServiceImplTest.java @@ -33,7 +33,7 @@ import org.openecomp.sdc.notification.exceptons.NotificationNotExistException; import java.util.UUID; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; /** diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/notification/services/impl/PropagationServiceImplTest.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/notification/services/impl/PropagationServiceImplTest.java index b118e023fa..21072d727e 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/notification/services/impl/PropagationServiceImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/notification/services/impl/PropagationServiceImplTest.java @@ -35,7 +35,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; -import static org.mockito.Matchers.anyList; +import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.Mockito.*; /** diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java index 771d9abf3c..0e3bf64751 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/ConsolidationServiceTest.java @@ -37,8 +37,8 @@ import java.io.IOException; import java.net.URISyntaxException; import java.util.*; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionServiceTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionServiceTest.java index 24293fda44..30fc214177 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionServiceTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/UnifiedCompositionServiceTest.java @@ -17,8 +17,8 @@ package org.openecomp.sdc.translator.services.heattotosca; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; @@ -647,7 +647,7 @@ public class UnifiedCompositionServiceTest { unifiedCompositionDataList.add(unifiedCompositionData); Mockito.doNothing().when(unifiedCompositionService).updNodesConnectedOutConnectivity (inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), unifiedCompositionDataList, context); - Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(), + Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(any(), anyString()); unifiedCompositionService .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), @@ -682,7 +682,7 @@ public class UnifiedCompositionServiceTest { Mockito.doNothing().when(unifiedCompositionService).updNodesConnectedOutConnectivity (inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), unifiedCompositionDataList, context); - Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(), + Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(any(), anyString()); unifiedCompositionService @@ -710,7 +710,7 @@ public class UnifiedCompositionServiceTest { unifiedCompositionDataList.add(unifiedCompositionData); Mockito.doNothing().when(unifiedCompositionService).updNodesConnectedOutConnectivity (inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), unifiedCompositionDataList, context); - Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(), + Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(any(), anyString()); unifiedCompositionService .updateCompositionConnectivity(inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), @@ -746,7 +746,7 @@ public class UnifiedCompositionServiceTest { Mockito.doNothing().when(unifiedCompositionService).updNodesConnectedOutConnectivity (inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML), unifiedCompositionDataList, context); - Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(), + Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(any(), anyString()); unifiedCompositionService @@ -774,7 +774,7 @@ public class UnifiedCompositionServiceTest { List<UnifiedCompositionData> unifiedCompositionDataList = new ArrayList<>(); unifiedCompositionDataList.add(unifiedCompositionData); - Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(), + Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(any(), anyString()); Optional<ServiceTemplate> substitutionServiceTemplate = unifiedCompositionService @@ -846,7 +846,7 @@ public class UnifiedCompositionServiceTest { inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML).getTopology_template().getNode_templates() .put(FSB1, abstractNodeTemplate); - Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(), + Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(any(), anyString()); unifiedCompositionService. @@ -886,7 +886,7 @@ public class UnifiedCompositionServiceTest { inputServiceTemplates.get(MAIN_SERVICE_TEMPLATE_YAML).getTopology_template().getNode_templates() .put(FSB1, abstractNodeTemplate); - Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(anyObject(), + Mockito.doReturn(FSB1).when(context).getUnifiedAbstractNodeTemplateId(any(), anyString()); unifiedCompositionService. diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImplTest.java index 1488edc16e..ec21bdb19c 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImplTest.java @@ -25,7 +25,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import java.io.IOException; diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImplTest.java index 2749185213..9859c33a16 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/ItemZusammenDaoImplTest.java @@ -17,7 +17,7 @@ package org.openecomp.sdc.versioning.dao.impl.zusammen; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; import static org.openecomp.sdc.versioning.dao.impl.zusammen.ItemZusammenDaoImpl.ItemInfoProperty.ITEM_TYPE; diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java index 74d75f7eee..3e0f84bfd3 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/dao/impl/zusammen/VersionZusammenDaoImplTest.java @@ -16,8 +16,8 @@ package org.openecomp.sdc.versioning.dao.impl.zusammen; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isNull; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verify; import static org.openecomp.sdc.versioning.dao.impl.zusammen.TestUtil.createZusammenContext; @@ -130,7 +130,7 @@ public class VersionZusammenDaoImplTest { String versionId = "versionId"; doReturn(new Id(versionId)).when(zusammenAdaptorMock) .createVersion(eq(createZusammenContext(USER)), eq(new Id(itemId)), - baseId == null ? isNull(Id.class) : eq(new Id(baseId)), + baseId == null ? isNull(/*Id.class*/) : eq(new Id(baseId)), capturedZusammenVersion.capture()); @@ -430,4 +430,4 @@ public class VersionZusammenDaoImplTest { Assert.assertEquals(revision.getUser(), zusammenRevision.getUser()); Assert.assertEquals(revision.getTime(), zusammenRevision.getTime()); } -}
\ No newline at end of file +} diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImplTest.java index e74e5d585f..e9c74f093c 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/AsdcItemManagerImplTest.java @@ -19,7 +19,7 @@ package org.openecomp.sdc.versioning.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; @@ -188,4 +188,4 @@ public class AsdcItemManagerImplTest { assertEquals(actual.getName(), expected.getName()); assertEquals(actual.getType(), expected.getType()); } -}
\ No newline at end of file +} diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java index 6c69582ad2..e40fea8edc 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-core/src/test/java/org/openecomp/sdc/versioning/impl/VersioningManagerImplTest.java @@ -20,8 +20,8 @@ package org.openecomp.sdc.versioning.impl; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.never; diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java index 8b732df95c..e8b98f44c4 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java @@ -43,7 +43,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.sdc.tosca.datatypes.model.AttributeDefinition; import org.onap.sdc.tosca.datatypes.model.CapabilityDefinition; import org.onap.sdc.tosca.datatypes.model.EntrySchema; diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java index 9d81b06daf..435f6e79ed 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java @@ -42,7 +42,7 @@ import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.sdc.tosca.datatypes.model.CapabilityDefinition; import org.onap.sdc.tosca.datatypes.model.CapabilityType; import org.onap.sdc.tosca.datatypes.model.Constraint; @@ -134,14 +134,14 @@ Modifications copyright (c) 2018-2019 Nokia <commons-jci-core.version>1.1</commons-jci-core.version> <!--TESTING--> - <mockito.version>3.7.7</mockito.version> + <mockito.version>4.10.0</mockito.version> <mockitoJupiter.version>${mockito.version}</mockitoJupiter.version> <jmockit.version>1.35</jmockit.version> - <junit.platform.version>1.7.1</junit.platform.version> - <junitJupiter.version>5.7.2</junitJupiter.version> + <junit.platform.version>1.9.1</junit.platform.version> + <junitJupiter.version>5.9.1</junitJupiter.version> <assertj.version>3.16.0</assertj.version> - <testng.version>7.4.0</testng.version> - <cucumber.version>6.8.1</cucumber.version> + <testng.version>7.7.0</testng.version> + <cucumber.version>7.10.1</cucumber.version> <bean-matchers.version>0.11</bean-matchers.version> <hamcrest.version>2.2</hamcrest.version> <hamcrest-all.version>1.3</hamcrest-all.version> |