Github user mjeelanimsft commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/548#discussion_r197976612 --- Diff: src/java/test/org/apache/zookeeper/common/NetUtilsTest.java --- @@ -0,0 +1,46 @@ +package apache.zookeeper.common; + +import org.apache.zookeeper.common.NetUtils; +import org.apache.zookeeper.ZKTestCase; +import org.hamcrest.core.AnyOf; +import org.hamcrest.core.IsEqual; +import org.junit.Assert; +import org.junit.Test; +import java.net.InetSocketAddress; + +public class NetUtilsTest extends ZKTestCase { + + private Integer port = 1234; + private String v4addr = "127.0.0.1"; + private String v6addr = "[0:0:0:0:0:0:0:1]"; + private String v4local = v4addr + ":" + port.toString(); + private String v6local = v6addr + ":" + port.toString(); + + @Test + public void testformatInetAddrGoodIpv4() { + InetSocketAddress isa = new InetSocketAddress(v4addr, port); + Assert.assertEquals("127.0.0.1:1234", NetUtils.formatInetAddr(isa)); + } + + @Test + public void testFormatInetAddrGoodIpv6() { --- End diff -- Thanks @anmolnar - I'll add the additional tests
---