### Question:
ServiceUtil { protected static Map<String, Integer> parseServiceSpec(String serviceSpec) { Map<String, Integer> serviceMap = new HashMap<String, Integer>(); if (serviceSpec != null) { String[] services = serviceSpec.split(","); if (services.length < 1) { throw new IllegalArgumentException("Invalid service specification: No services found."); } for (int i = 0; i < services.length; i++) { String service = services[i]; int index = service.indexOf(":"); if (index < 0) { throw new IllegalArgumentException("Invalid service specification: No name or port defined."); } Integer port = Integer.valueOf(Integer.parseInt(service.substring(index + 1))); serviceMap.put(service.substring(0, index), port); } } return serviceMap; }    }### Answer:
@Test(expectedExceptions = IllegalArgumentException.class) public void testEmptySpec() { ServiceUtil.parseServiceSpec(""); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testInvalidDelimiter() { ServiceUtil.parseServiceSpec("service:1;something;2"); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testInvalidPort() { ServiceUtil.parseServiceSpec("service,noport"); }