diff options
author | Neil Derraugh <neil.derraugh@yoppworks.com> | 2020-05-20 23:59:37 -0400 |
---|---|---|
committer | Neil Derraugh <neil.derraugh@yoppworks.com> | 2020-05-31 12:48:38 -0400 |
commit | 95bdca4419af09c4eeab5562589ea6baf9a4490d (patch) | |
tree | a91c2e9869c3e9f4849026503703e33d80870aa0 /session-lib/src/test/java/org | |
parent | 74dc5044f00a113eef41b345390f8c266112b2d7 (diff) |
Upgrade Junit to 5.6
- Update @Before -> @BeforeEach, @After -> @AfterEach
- Update Mockito usage
- Update assertThrows so not to expect exceptions
Issue-ID: SDC-3078
Signed-off-by: Neil Derraugh <neil.derraugh@yoppworks.com>
Change-Id: I0b1056698767c4b060e243bbda799253072b4b55
Diffstat (limited to 'session-lib/src/test/java/org')
-rw-r--r-- | session-lib/src/test/java/org/onap/sdc/common/session/SdcSessionContextProviderTest.java | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/session-lib/src/test/java/org/onap/sdc/common/session/SdcSessionContextProviderTest.java b/session-lib/src/test/java/org/onap/sdc/common/session/SdcSessionContextProviderTest.java index 7aa002a..a118973 100644 --- a/session-lib/src/test/java/org/onap/sdc/common/session/SdcSessionContextProviderTest.java +++ b/session-lib/src/test/java/org/onap/sdc/common/session/SdcSessionContextProviderTest.java @@ -17,10 +17,11 @@ package org.onap.sdc.common.session; import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.onap.sdc.common.session.impl.SdcSessionContextProvider; import org.onap.sdc.common.session.impl.SessionException; @@ -28,21 +29,27 @@ public class SdcSessionContextProviderTest { private SdcSessionContextProvider sdcSessionContextProvider; - @Before + @BeforeEach public void init() { sdcSessionContextProvider = new SdcSessionContextProvider(); } - @Test(expected = SessionException.class) + @Test public void createSessionNoTenant() { sdcSessionContextProvider.create("user", null); - sdcSessionContextProvider.get(); + assertThrows( + SessionException.class, + () -> sdcSessionContextProvider.get() + ); } - @Test(expected = SessionException.class) + @Test public void createSessionNoUser() { sdcSessionContextProvider.create(null, "t1"); - sdcSessionContextProvider.get(); + assertThrows( + SessionException.class, + () -> sdcSessionContextProvider.get() + ); } @Test @@ -55,7 +62,7 @@ public class SdcSessionContextProviderTest { assertEquals(tenant, sessionContext.getTenant()); } - @After + @AfterEach public void cleanup() { sdcSessionContextProvider.close(); } |