aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-02-19 19:04:13 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-02-20 07:46:00 +0000
commitdb65955fc93a81911ef66ab88b380dc1a5926dce (patch)
treedbc27f8b2b5cd72fbb825288dc0c4a4ade3d1ad9 /openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src
parentd6992c860be02a4c88b8f49234d8ee7e117dd60a (diff)
Fix BLOCKER BUGs reported by Sonar
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: I00c466ac3fcbe8fab4629aed3a36bb2d8af3a970 Issue-ID: SDC-3472
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src')
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src/test/java/org/openecomp/sdc/common/session/impl/AsdcSessionContextProviderTest.java43
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src/test/java/org/openecomp/sdc/common/session/impl/SessionContextProviderFactoryImplTest.java18
2 files changed, 34 insertions, 27 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src/test/java/org/openecomp/sdc/common/session/impl/AsdcSessionContextProviderTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src/test/java/org/openecomp/sdc/common/session/impl/AsdcSessionContextProviderTest.java
index f0a9d2dcf7..80b62c7409 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src/test/java/org/openecomp/sdc/common/session/impl/AsdcSessionContextProviderTest.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src/test/java/org/openecomp/sdc/common/session/impl/AsdcSessionContextProviderTest.java
@@ -19,45 +19,48 @@
package org.openecomp.sdc.common.session.impl;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.session.SessionContext;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-public class AsdcSessionContextProviderTest {
+@ExtendWith(MockitoExtension.class)
+class AsdcSessionContextProviderTest {
private static final String USER_ID = "cs0008";
@InjectMocks
private AsdcSessionContextProvider asdcSessionContextProvider;
- @BeforeMethod
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test(expectedExceptions = CoreException.class)
- public void testGetUserIdNull() {
+ @Test
+ void testGetUserIdNull() {
asdcSessionContextProvider.create(null, null);
- asdcSessionContextProvider.get();
+ Assertions.assertThrows(CoreException.class, () -> {
+ asdcSessionContextProvider.get();
+ });
}
- @Test(expectedExceptions = CoreException.class)
- public void testGetTenantNull() {
+ @Test
+ void testGetTenantNull() {
asdcSessionContextProvider.create(USER_ID, null);
- asdcSessionContextProvider.get();
+ Assertions.assertThrows(CoreException.class, () -> {
+ asdcSessionContextProvider.get();
+ });
}
@Test
- public void testGet() {
+ void testGet() {
asdcSessionContextProvider.create(USER_ID, "tenant");
SessionContext sessionContext = asdcSessionContextProvider.get();
- Assert.assertNotNull(sessionContext);
- Assert.assertSame(USER_ID, sessionContext.getUser().getUserId());
- Assert.assertSame("tenant", sessionContext.getTenant());
+ assertNotNull(sessionContext);
+ assertSame(USER_ID, sessionContext.getUser().getUserId());
+ assertSame("tenant", sessionContext.getTenant());
}
}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src/test/java/org/openecomp/sdc/common/session/impl/SessionContextProviderFactoryImplTest.java b/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src/test/java/org/openecomp/sdc/common/session/impl/SessionContextProviderFactoryImplTest.java
index eec7bd02ad..74cf8d3446 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src/test/java/org/openecomp/sdc/common/session/impl/SessionContextProviderFactoryImplTest.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-session-lib/src/test/java/org/openecomp/sdc/common/session/impl/SessionContextProviderFactoryImplTest.java
@@ -19,27 +19,31 @@
package org.openecomp.sdc.common.session.impl;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.openecomp.sdc.common.session.SessionContextProvider;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-public class SessionContextProviderFactoryImplTest {
+@ExtendWith(MockitoExtension.class)
+class SessionContextProviderFactoryImplTest {
@InjectMocks
private SessionContextProviderFactoryImpl sessionContextProviderFactoryImpl;
- @BeforeMethod
+ @BeforeEach
public void setUp() {
MockitoAnnotations.initMocks(this);
}
@Test
- public void testCreateInterface() {
+ void testCreateInterface() {
SessionContextProvider sessionContextProvider = sessionContextProviderFactoryImpl.createInterface();
- Assert.assertTrue(sessionContextProvider instanceof AsdcSessionContextProvider);
+ assertTrue(sessionContextProvider instanceof AsdcSessionContextProvider);
}
}