From: lubos-cicut Date: Mon, 20 May 2024 12:36:20 +0000 (+0200) Subject: Migrate netconf-server/mapping tests to JUnit5 X-Git-Tag: v7.0.6~2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=a5832ae3e3a23e3590ede4d6151886abd4b82cae;p=netconf.git Migrate netconf-server/mapping tests to JUnit5 Migrate tests in protocol/netconf-server/mapping from JUnit4 to JUnit5. JIRA: NETCONF-1310 Change-Id: Ia8578ea11320918012e236facbf2766f232df89c Signed-off-by: lubos-cicut --- diff --git a/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/mapping/operations/DefaultCloseSessionTest.java b/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/mapping/operations/DefaultCloseSessionTest.java index 13dd56a6c7..d58ea96819 100644 --- a/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/mapping/operations/DefaultCloseSessionTest.java +++ b/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/mapping/operations/DefaultCloseSessionTest.java @@ -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(); diff --git a/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/mapping/operations/DefaultStopExiTest.java b/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/mapping/operations/DefaultStopExiTest.java index 039eb3c180..be0f1b471f 100644 --- a/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/mapping/operations/DefaultStopExiTest.java +++ b/protocol/netconf-server/src/test/java/org/opendaylight/netconf/server/mapping/operations/DefaultStopExiTest.java @@ -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);