Clean up NetconfServerSessionNegotiatorTest
[netconf.git] / protocol / netconf-server / src / test / java / org / opendaylight / netconf / server / NetconfServerSessionNegotiatorTest.java
index 3fbf785d77022162f2e68fa613bf0d1e38d9b3f1..d9f72c4896f0b3d1f38800b5a589fd231b9bea56 100644 (file)
@@ -7,38 +7,34 @@
  */
 package org.opendaylight.netconf.server;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 import io.netty.channel.local.LocalAddress;
 import java.net.InetSocketAddress;
-import org.junit.Test;
-import org.opendaylight.netconf.shaded.sshd.common.util.net.SshdSocketAddress;
+import org.junit.jupiter.api.Test;
 
-public class NetconfServerSessionNegotiatorTest {
+class NetconfServerSessionNegotiatorTest {
     @Test
-    public void testGetInetSocketAddress() throws Exception {
-
-        InetSocketAddress socketAddress = new InetSocketAddress(10);
-
-        assertNotNull(NetconfServerSessionNegotiator.getHostName(socketAddress));
-
-        assertEquals(socketAddress.getHostName(),
-            NetconfServerSessionNegotiator.getHostName(socketAddress).getValue());
-
-        socketAddress = new InetSocketAddress("TestPortInet", 20);
-
-        assertEquals(socketAddress.getHostName(),
-            NetconfServerSessionNegotiator.getHostName(socketAddress).getValue());
-
-        assertEquals(String.valueOf(socketAddress.getPort()),
-            NetconfServerSessionNegotiator.getHostName(socketAddress).getKey());
-
-        LocalAddress localAddress = new LocalAddress("TestPortLocal");
+    void testPortTen() {
+        final var address = new InetSocketAddress(10);
+        final var hostname = NetconfServerSessionNegotiator.getHostName(address);
+        assertNotNull(hostname);
+        assertEquals(address.getHostName(), hostname.getValue());
+    }
 
-        assertEquals(String.valueOf(localAddress.id()),
-            NetconfServerSessionNegotiator.getHostName(localAddress).getValue());
+    @Test
+    void testPortTwenty() {
+        final var address = new InetSocketAddress("TestPortInet", 20);
+        final var hostname = NetconfServerSessionNegotiator.getHostName(address);
+        assertEquals(address.getHostName(), hostname.getValue());
+        assertEquals(String.valueOf(address.getPort()), hostname.getKey());
+    }
 
-        SshdSocketAddress embeddedAddress = new SshdSocketAddress("TestSshdName", 10);
+    @Test
+    void testGetInetSocketAddress() {
+        final var address = new LocalAddress("TestPortLocal");
+        final var hostname = NetconfServerSessionNegotiator.getHostName(address);
+        assertEquals(String.valueOf(address.id()), hostname.getValue());
     }
 }