TextFormatter { public static StringBuilder inetAddress(@Nullable InetAddress addr) { final StringBuilder buf = new StringBuilder(32); appendInetAddress(buf, addr); return buf; } private  TextFormatter(); static StringBuilder elapsed(long elapsedNanos); static StringBuilder elapsed(long startTimeNanos, long endTimeNanos); static void appendElapsed(StringBuilder buf, long elapsedNanos); static void appendElapsed(StringBuilder buf, long startTimeNanos, long endTimeNanos); static StringBuilder size(long size); static void appendSize(StringBuilder buf, long size); static StringBuilder elapsedAndSize(long startTimeNanos, long endTimeNanos, long size); static void appendElapsedAndSize(
            StringBuilder buf, long startTimeNanos, long endTimeNanos, long size); static StringBuilder epochMillis(long timeMillis); static void appendEpochMillis(StringBuilder buf, long timeMillis); static StringBuilder epochMicros(long timeMicros); static void appendEpochMicros(StringBuilder buf, long timeMicros); static StringBuilder socketAddress(@Nullable SocketAddress addr); static void appendSocketAddress(StringBuilder buf, @Nullable SocketAddress addr); static StringBuilder inetAddress(@Nullable InetAddress addr); static void appendInetAddress(StringBuilder buf, @Nullable InetAddress addr);  }
@Test void inetAddress() throws Exception { assertThat(TextFormatter.inetAddress(null) .toString()).isEqualTo("null"); assertThat(TextFormatter.inetAddress(InetAddress.getByAddress(new byte[] { 1, 2, 3, 4 })) .toString()).isEqualTo("1.2.3.4"); assertThat(TextFormatter.inetAddress(InetAddress.getByAddress("foo", new byte[] { 5, 6, 7, 8 })) .toString()).isEqualTo("foo/5.6.7.8"); assertThat(TextFormatter.inetAddress(InetAddress.getByAddress("1.2.3.4", new byte[] { 5, 6, 7, 8 })) .toString()).isEqualTo("1.2.3.4/5.6.7.8"); assertThat(TextFormatter.inetAddress(InetAddress.getByName("repo.maven.apache.org")) .toString()).matches("^repo\\.maven\\.apache\\.org/.+$"); }