Migrate netconf-server/mapping tests to JUnit5 75/111775/1
authorlubos-cicut <lubos.cicut@pantheon.tech>
Mon, 20 May 2024 12:36:20 +0000 (14:36 +0200)
committerlubos-cicut <lubos.cicut@pantheon.tech>
Mon, 20 May 2024 12:36:20 +0000 (14:36 +0200)
Migrate tests in protocol/netconf-server/mapping from JUnit4 to JUnit5.

JIRA: NETCONF-1310
Change-Id: Ia8578ea11320918012e236facbf2766f232df89c
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/mapping/operations/DefaultCloseSessionTest.java
protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/mapping/operations/DefaultStopExiTest.java

index 13dd56a6c7a62284d1667c3b6f08fc3e69de3df7..d58ea96819dcf54d563a32d55499be93314610b1 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.netconf.server.mapping.operations;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doNothing;
@@ -23,7 +23,7 @@ import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelPromise;
 import io.netty.channel.EventLoop;
 import io.netty.util.concurrent.GenericFutureListener;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.api.NetconfDocumentedException;
 import org.opendaylight.netconf.api.NetconfTerminationReason;
@@ -37,7 +37,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.re
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.w3c.dom.Document;
 
-public class DefaultCloseSessionTest {
+class DefaultCloseSessionTest {
 
     private static void mockEventLoop(final Channel channel) {
         final var eventLoop = mock(EventLoop.class);
@@ -50,7 +50,7 @@ public class DefaultCloseSessionTest {
     }
 
     @Test
-    public void testDefaultCloseSession() throws Exception {
+    void testDefaultCloseSession() throws Exception {
         AutoCloseable res = mock(AutoCloseable.class);
         doNothing().when(res).close();
         DefaultCloseSession close = new DefaultCloseSession(new SessionIdType(Uint32.TEN), res);
@@ -89,7 +89,7 @@ public class DefaultCloseSessionTest {
     }
 
     @Test
-    public void testDefaultCloseSession2() throws Exception {
+    void testDefaultCloseSession2() throws Exception {
         final var expectedCause = new NetconfDocumentedException("testMessage");
         final var res = mock(AutoCloseable.class);
         doThrow(expectedCause).when(res).close();
index 039eb3c180306bcd178b2a44c9b9c8ef5aa790b9..be0f1b471f1ec3d7a010d128219fccd9c4a6204e 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.netconf.server.mapping.operations;
 
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.Mockito.doReturn;
@@ -18,7 +18,7 @@ import static org.mockito.Mockito.verify;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelPipeline;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlUtil;
 import org.opendaylight.netconf.server.NetconfServerSession;
@@ -26,9 +26,9 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.re
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.w3c.dom.Document;
 
-public class DefaultStopExiTest {
+class DefaultStopExiTest {
     @Test
-    public void testHandleWithNoSubsequentOperations() throws Exception {
+    void testHandleWithNoSubsequentOperations() throws Exception {
         final DefaultStopExi exi = new DefaultStopExi(new SessionIdType(Uint32.ONE));
         final Document doc = XmlUtil.newDocument();
         Channel channel = mock(Channel.class);