### Question:
NetUtils { public static Endpoint parseEndpoint(String endpointStr) { String[] endpointParts = StringUtils.split(endpointStr, ':'); checkArgument(2 == endpointParts.length, "Invalid endpoint string %s - It should be 'host:port'.", endpointStr); String host = endpointParts[0]; int port; try { port = Integer.parseInt(endpointParts[1]); } catch (NumberFormatException nfe) { throw new IllegalArgumentException("Invalid port found in the endpoint string " + endpointStr, nfe); } return createEndpoint(host, port); }  static InetSocketAddress of(Endpoint endpoint); static String getLocalHostName(boolean useHostname); static Endpoint getLocalEndpoint(int port, boolean useHostname); static List<Endpoint> parseEndpoints(String endpointStr); static Endpoint parseEndpoint(String endpointStr); static Endpoint createEndpoint(String hostname, int port); static String endpointToString(Endpoint ep);  }### Answer:
@Test public void testParseEndpoint() { String endpointStr = "10.138.10.56:12345"; Endpoint endpoint = parseEndpoint(endpointStr); assertEquals("10.138.10.56", endpoint.getHostname()); assertEquals(12345, endpoint.getPort()); }
@Test(expected = IllegalArgumentException.class) public void testParseInvalidEndpoint1() { parseEndpoint("10.138.10.56"); }
@Test(expected = IllegalArgumentException.class) public void testParseInvalidEndpoint2() { parseEndpoint("10.138.10.56:"); }
@Test(expected = IllegalArgumentException.class) public void testParseInvalidEndpoint3() { parseEndpoint("10.138.10.56:123456:123456"); }
@Test(expected = IllegalArgumentException.class) public void testParseInvalidEndpointPort() { parseEndpoint("10.138.10.56:abcd"); }
@Test(expected = IllegalArgumentException.class) public void testParseEmptyEndpoints() { parseEndpoint(""); }