diff options
author | vasraz <vasyl.razinkov@est.tech> | 2022-12-24 00:57:54 +0000 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2023-01-03 14:29:22 +0000 |
commit | 5b1a92cea1fb437c236a77468f3e8e351e25a990 (patch) | |
tree | 0df24473b25236a646a094cfcd18ede5c61fc1e1 /openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test | |
parent | 5357edd8fb443613f4be4e8a30b03f2a7134e61d (diff) |
Upgrade testing frameworks to latest not-vulnerable versions
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Change-Id: Ie68290a79d075132c73e6cc9e82b9dbda92fbe8c
Issue-ID: SDC-4313
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/test')
5 files changed, 56 insertions, 56 deletions
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; |