diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-02-22 14:01:13 +0000 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2021-02-22 15:10:48 +0000 |
commit | 72b29baac0c1f08b610fd4daf2078b43ee74b3d8 (patch) | |
tree | 4d1bb5a225899fea804f109e0c0439f9d8f3944e /openecomp-be/lib | |
parent | 1e12c6b9b28c49ed02ab8d2f156a6cf52cc305d7 (diff) |
Remove testNG dependencies
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Change-Id: Ib7632106f9fc0703a90ec3c41cebd5d22471adfd
Issue-ID: SDC-3108
Diffstat (limited to 'openecomp-be/lib')
8 files changed, 46 insertions, 36 deletions
diff --git a/openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java b/openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java index e08238aa1f..e8b6efa683 100644 --- a/openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java +++ b/openecomp-be/lib/openecomp-common-lib/src/test/java/org/openecomp/sdc/common/utils/CommonUtilTest.java @@ -20,20 +20,20 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.onap.sdc.tosca.services.CommonUtil.DEFAULT; import static org.onap.sdc.tosca.services.CommonUtil.UNDERSCORE_DEFAULT; -import static org.testng.Assert.assertTrue; import com.google.common.io.Files; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; +import org.junit.Test; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.zip.exception.ZipException; -import org.testng.annotations.Test; public class CommonUtilTest { private static final String VALID_ZIP_FILE_PATH = "src/test/resources/valid.zip"; @@ -70,7 +70,7 @@ public class CommonUtilTest { assertThat(fch.containsFile("file.two.yaml"), is(true)); } - @Test(expectedExceptions={CoreException.class}) + @Test(expected=CoreException.class) public void testValidateNoFolders() throws IOException { byte[] file = getFileAsBytes(VALID_ZIP_WITH_DIR_FILE_PATH); diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/test/java/org/openecomp/core/util/UniqueValueUtilTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/test/java/org/openecomp/core/util/UniqueValueUtilTest.java index 72ae4e7227..9b8228d94c 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/test/java/org/openecomp/core/util/UniqueValueUtilTest.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-api/src/test/java/org/openecomp/core/util/UniqueValueUtilTest.java @@ -19,6 +19,9 @@ package org.openecomp.core.util; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -29,7 +32,6 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.openecomp.core.dao.UniqueValueDao; import org.openecomp.core.dao.types.UniqueValueEntity; import org.openecomp.sdc.common.errors.CoreException; -import org.testng.Assert; @ExtendWith(MockitoExtension.class) class UniqueValueUtilTest { @@ -111,12 +113,12 @@ class UniqueValueUtilTest { @Test void testIsUniqueValueOccupied() { Mockito.when(uniqueValueDao.get(Mockito.any())).thenReturn(new UniqueValueEntity()); - Assert.assertTrue(uniqueValueUtil.isUniqueValueOccupied(ENTITLEMENT_POOL_NAME, ORIGINAL_ENTITY_NAME)); + assertTrue(uniqueValueUtil.isUniqueValueOccupied(ENTITLEMENT_POOL_NAME, ORIGINAL_ENTITY_NAME)); } @Test void testIsUniqueValueOccupiedFalse() { Mockito.when(uniqueValueDao.get(Mockito.any())).thenReturn(null); - Assert.assertFalse(uniqueValueUtil.isUniqueValueOccupied(ENTITLEMENT_POOL_NAME, ORIGINAL_ENTITY_NAME)); + assertFalse(uniqueValueUtil.isUniqueValueOccupied(ENTITLEMENT_POOL_NAME, ORIGINAL_ENTITY_NAME)); } } diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/LastSeenNotificationEntityTest.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/LastSeenNotificationEntityTest.java index 823a7f2166..dc2f2d3126 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/LastSeenNotificationEntityTest.java +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/LastSeenNotificationEntityTest.java @@ -16,11 +16,13 @@ package org.openecomp.sdc.notification.dao.types; -import org.testng.annotations.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import java.util.UUID; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.*; /** * @author EVITALIY diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/NotificationEntityTest.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/NotificationEntityTest.java index eff4d24995..4089ebf12f 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/NotificationEntityTest.java +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/NotificationEntityTest.java @@ -16,12 +16,12 @@ package org.openecomp.sdc.notification.dao.types; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import java.util.UUID; +import org.junit.jupiter.api.Test; -import org.testng.annotations.Test; /** * @author EVITALIY diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/SubscribersEntityTest.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/SubscribersEntityTest.java index b5761dcc72..023294bf8b 100644 --- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/SubscribersEntityTest.java +++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-api/src/test/java/org/openecomp/sdc/notification/dao/types/SubscribersEntityTest.java @@ -16,15 +16,16 @@ package org.openecomp.sdc.notification.dao.types; -import org.testng.annotations.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import java.util.Collections; import java.util.HashSet; import java.util.Set; import java.util.UUID; +import org.junit.jupiter.api.Test; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotEquals; /** * @author EVITALIY diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java index 5b04c6c6f8..37174a91e7 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java @@ -16,11 +16,14 @@ package org.openecomp.sdc.heat.services.tree; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +import org.junit.jupiter.api.Test; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; -import org.testng.Assert; -import org.testng.annotations.Test; import java.io.File; import java.io.FileInputStream; @@ -50,8 +53,8 @@ public class HeatTreeManagerTest { HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileContentMap); heatTreeManager.createTree(); HeatStructureTree tree = heatTreeManager.getTree(); - Assert.assertNotNull(tree); - Assert.assertEquals(tree.getHeat().size(), 2); + assertNotNull(tree); + assertEquals(tree.getHeat().size(), 2); } @Test @@ -74,8 +77,8 @@ public class HeatTreeManagerTest { HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileContentMap); heatTreeManager.createTree(); HeatStructureTree tree = heatTreeManager.getTree(); - Assert.assertNotNull(tree); - Assert.assertEquals(tree.getHeat().size(), 3); + assertNotNull(tree); + assertEquals(tree.getHeat().size(), 3); verifyHeatArtifacts(tree, "ocgmgr.yaml", 1); verifyHeatArtifacts(tree, "ocgapp.yaml", 0); verifyHeatArtifacts(tree, "base_ocg.yaml", 0); @@ -84,12 +87,12 @@ public class HeatTreeManagerTest { private void verifyHeatArtifacts(HeatStructureTree tree, String heatName, int expectedArtifactNum ) { HeatStructureTree heat = HeatStructureTree.getHeatStructureTreeByName(tree.getHeat(), heatName); - Assert.assertNotNull(heat); + assertNotNull(heat); if (expectedArtifactNum > 0) { - Assert.assertNotNull(heat.getArtifacts()); - Assert.assertEquals(heat.getArtifacts().size(), expectedArtifactNum); + assertNotNull(heat.getArtifacts()); + assertEquals(heat.getArtifacts().size(), expectedArtifactNum); } else { - Assert.assertNull(heat.getArtifacts()); + assertNull(heat.getArtifacts()); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/base/ResourceBaseValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/base/ResourceBaseValidatorTest.java index ec39ead030..35a8c00ee9 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/base/ResourceBaseValidatorTest.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/base/ResourceBaseValidatorTest.java @@ -15,19 +15,20 @@ */ package org.openecomp.sdc.validation.base; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + import org.apache.commons.collections4.MapUtils; +import org.junit.jupiter.api.Test; import org.openecomp.core.validation.types.MessageContainer; import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration; import org.openecomp.sdc.validation.type.ConfigConstants; import org.openecomp.sdc.validation.util.ValidationTestUtil; -import org.testng.Assert; -import org.testng.annotations.Test; import java.util.Collections; import java.util.HashMap; import java.util.Map; -@Test public class ResourceBaseValidatorTest { private String testValidator = "testValidator"; @@ -36,7 +37,7 @@ private String testValidator = "testValidator"; ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); Map<String, MessageContainer> messages = ValidationTestUtil.testValidator( resourceBaseValidator, "/InvalidResourceType"); - Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), + assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), "WARNING: [RBV1]: A resource has an invalid or unsupported type - null, " + "Resource ID [FSB2]"); } @@ -46,7 +47,7 @@ private String testValidator = "testValidator"; ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); Map<String, MessageContainer> messages = ValidationTestUtil.testValidator(resourceBaseValidator, "/InvalidHeatStructure"); - Assert.assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), + assertEquals(messages.get("first.yaml").getErrorMessageList().get(0).getMessage(), "ERROR: [RBV2]: Invalid HEAT format problem - [while scanning for the next " + "token\n" + "found character '\\t(TAB)' that cannot start any token. " + "(Do not use \\t(TAB) for indentation)\n" + @@ -62,7 +63,7 @@ private String testValidator = "testValidator"; Map<String, Object> properties = new HashMap<>(); resourceBaseValidator.init(properties); - Assert.assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); + assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); } @Test @@ -72,8 +73,8 @@ private String testValidator = "testValidator"; Map<String, ImplementationConfiguration> resourceTypeToImpl = resourceBaseValidator.getResourceTypeToImpl(); - Assert.assertTrue(MapUtils.isNotEmpty(resourceTypeToImpl)); - Assert.assertTrue(resourceTypeToImpl.containsKey(testValidator)); + assertTrue(MapUtils.isNotEmpty(resourceTypeToImpl)); + assertTrue(resourceTypeToImpl.containsKey(testValidator)); } @Test @@ -84,7 +85,7 @@ private String testValidator = "testValidator"; resourceBaseValidator.init(properties); - Assert.assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); + assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); } @Test @@ -92,7 +93,7 @@ private String testValidator = "testValidator"; ResourceBaseValidator resourceBaseValidator = new ResourceBaseValidator(); initProperties(resourceBaseValidator, new HashMap<>()); - Assert.assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); + assertTrue(MapUtils.isEmpty(resourceBaseValidator.getResourceTypeToImpl())); } public Map<String, Object> getValidImplementationConfiguration() { diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java index 75a581e776..608208c707 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/test/java/org/openecomp/sdc/validation/util/ValidationTestUtil.java @@ -16,6 +16,8 @@ package org.openecomp.sdc.validation.util; +import static org.junit.jupiter.api.Assertions.assertEquals; + import org.apache.commons.collections4.MapUtils; import org.apache.commons.io.IOUtils; import org.openecomp.core.utilities.file.FileUtils; @@ -33,7 +35,6 @@ import org.openecomp.sdc.validation.ResourceValidator; import org.openecomp.sdc.validation.ValidationContext; import org.openecomp.sdc.validation.Validator; import org.openecomp.sdc.validation.base.ResourceBaseValidator; -import org.testng.Assert; import java.io.File; import java.io.FileInputStream; @@ -177,7 +178,7 @@ public class ValidationTestUtil { public static void validateErrorMessage(String actualMessage, String expected, String... params) { - Assert.assertEquals(actualMessage.replace("\n", "").replace("\r", ""), + assertEquals(actualMessage.replace("\n", "").replace("\r", ""), ErrorMessagesFormatBuilder.getErrorWithParameters(expected, params).replace("\n", "") .replace("\r", "")); } |