### Question:
NetUtil { public static String toStringAddress(SocketAddress address) { if (address == null) { return StringUtils.EMPTY; } return toStringAddress((InetSocketAddress) address); }  static String toStringAddress(SocketAddress address); static String toIpAddress(SocketAddress address); static String toStringAddress(InetSocketAddress address); static InetSocketAddress toInetSocketAddress(String address); static long toLong(String address); static String getLocalIp(); static String getLocalHost(); static InetAddress getLocalAddress(); static void validAddress(InetSocketAddress address); static boolean isValidIp(String ip, boolean validLocalAndAny);  }### Answer:
@Test public void testToStringAddress() { try { String stringAddress = NetUtil.toStringAddress(InetSocketAddress.createUnresolved("127.0.0.1", 9828)); } catch (Exception e) { assertThat(e).isInstanceOf(NullPointerException.class); } }
@Test public void testToStringAddress1() { assertThat(NetUtil.toStringAddress((SocketAddress)ipv4)) .isEqualTo(ipv4.getAddress().getHostAddress() + ":" + ipv4.getPort()); assertThat(NetUtil.toStringAddress((SocketAddress)ipv6)).isEqualTo( ipv6.getAddress().getHostAddress() + ":" + ipv6.getPort()); }
@Test public void testToStringAddress2() { assertThat(NetUtil.toStringAddress(ipv4)).isEqualTo( ipv4.getAddress().getHostAddress() + ":" + ipv4.getPort()); assertThat(NetUtil.toStringAddress(ipv6)).isEqualTo( ipv6.getAddress().getHostAddress() + ":" + ipv6.getPort()); }