### Question:
Main { public static String getUrlFromArgs(String[] args) { if (args == null || args.length < 1) { throw new IllegalArgumentException("Collector URL is required"); } return args[0]; }  static String getUrlFromArgs(String[] args); static void main(String[] args);  }### Answer:
@Test public void testGetUrl() { String[] sample = {"com.acme", "world"}; assertEquals("com.acme", Main.getUrlFromArgs(sample)); }
@Test(expected = IllegalArgumentException.class) public void testGetUrlNull() { Main.getUrlFromArgs(null); }
@Test(expected = IllegalArgumentException.class) public void testGetUrlEmpty() { Main.getUrlFromArgs(new String[]{}); }