### Question:
NetworkAddress { public static NetworkAddress parse(String networkAddress) { NetworkAddress address = null; if (networkAddress != null) { String[] split = networkAddress.split("/"); if (split.length == 2) { byte[] network = parseDottedQuad(split[0]); byte[] netmask = parseDottedQuad(split[1]); address = toNetworkAddress(network, netmask); } else { throw new IllegalArgumentException("Network address must be ip4Address/netMask"); } } return address; } private  NetworkAddress(byte[] network, byte[] netmask); @Override String toString(); boolean isAddressInNetwork(String address); static NetworkAddress parse(String networkAddress); static NetworkAddress parseBlock(String networkAddress); static boolean isValidIPAddress(String networkAddress);  }### Answer:
@Test public void testInvalidFormat() { try { NetworkAddress networkAddress = NetworkAddress.parse("64.12.96.0|255.255.224.0"); Assert.fail("expected Illegal arguement exception"); } catch (IllegalArgumentException e) { } }
@Test public void testInvalidAddressFormat() { try { NetworkAddress networkAddress = NetworkAddress.parse("12.96.0/255.255.224.0"); Assert.fail("expected Illegal arguement exception"); } catch (IllegalArgumentException e) { } }
@Test public void testInvalidAddressValue() { try { NetworkAddress networkAddress = NetworkAddress.parse("256.12.96.0/255.255.224.0"); Assert.fail("expected Illegal arguement exception"); } catch (IllegalArgumentException e) { } try { NetworkAddress networkAddress = NetworkAddress.parse("255.12.96.-1/255.255.224.0"); Assert.fail("expected Illegal arguement exception"); } catch (IllegalArgumentException e) { } }
@Test public void testInvalidMaskValue() { try { NetworkAddress networkAddress = NetworkAddress.parse("255.12.96.0/256.255.224.0"); Assert.fail("expected Illegal arguement exception"); } catch (IllegalArgumentException e) { } try { NetworkAddress networkAddress = NetworkAddress.parse("255.12.96.0/255.255.224.-1"); Assert.fail("expected Illegal arguement exception"); } catch (IllegalArgumentException e) { } }