### Question:
InetSocketAddressHelper { public static InetSocketAddress parse(String value) { Preconditions.checkNotNull(value); String[] spec = value.split(":", 2); if (spec.length != 2) { throw new IllegalArgumentException("Invalid socket address spec: " + value); } String host = spec[0]; int port = asPort(spec[1]); return StringUtils.isEmpty(host) ? new InetSocketAddress(port) : InetSocketAddress.createUnresolved(host, port); } private  InetSocketAddressHelper(); static InetSocketAddress parse(String value); static String toString(InetSocketAddress value);  }### Answer:
@Test public void testParseValueInvalid() { try { InetSocketAddressHelper.parse(null); fail(); } catch (NullPointerException e) { } try { InetSocketAddressHelper.parse(""); fail(); } catch (IllegalArgumentException e) { } try { InetSocketAddressHelper.parse(":"); fail(); } catch (IllegalArgumentException e) { } try { InetSocketAddressHelper.parse("*:"); fail(); } catch (IllegalArgumentException e) { } try { InetSocketAddressHelper.parse(":jake"); fail(); } catch (IllegalArgumentException e) { } try { InetSocketAddressHelper.parse(":70000"); fail(); } catch (IllegalArgumentException e) { } try { InetSocketAddressHelper.parse("localhost:"); fail(); } catch (IllegalArgumentException e) { } }
@Test public void testParseArgValuePort() { assertEquals(new InetSocketAddress(6666), InetSocketAddressHelper.parse(":6666")); assertEquals(new InetSocketAddress(0), InetSocketAddressHelper.parse(":*")); }
@Test public void testParseArgValueHostPort() { assertEquals(InetSocketAddress.createUnresolved("localhost", 5555), InetSocketAddressHelper.parse("localhost:5555")); assertEquals(InetSocketAddress.createUnresolved("127.0.0.1", 4444), InetSocketAddressHelper.parse("127.0.0.1:4444")); }