Starter { @SuppressWarnings("unchecked") public static void main(String[] args) throws Exception { if (args.length == 0 || args[0].equals("-h") || args[0].equals("--help")) { printSintax(); return; } String tmp = args[0].substring(1); String type = Character.toUpperCase(tmp.charAt(0)) + tmp.substring(1); Class<StarterType> clazz = (Class<StarterType>) Class .forName(Starter.class.getPackage().getName() + ".StarterType" + type); StarterType instance = clazz.newInstance(); instance.execute(args); }  @SuppressWarnings("unchecked") static void main(String[] args);  }
@Test public void testURL() throws Exception { assertNotFound(); String url = getClass().getResource("mycontainer-main.bsh").toString(); Starter.main(new String[] { "-url", url }); assertFound(); }
@Test public void testFile() throws Exception { assertNotFound(); Starter.main(new String[] { "-file", "src/test/resources/com/googlecode/mycontainer/starter/mycontainer-main.bsh" }); assertFound(); }
@Test public void testResource() throws Exception { assertNotFound(); Starter.main(new String[] { "-resource", "com/googlecode/mycontainer/starter/mycontainer-main.bsh" }); assertFound(); }