Main { public static void main(String... args) throws Exception { AbstractCommand command = Main.parseCommandLine(args); try { command.execute(); } catch (Exception err) { if (command instanceof Command && ((Command) command).verbose) { err.printStackTrace(); } else { System.err.println("An error occurred: " + err.getMessage()); } System.exit(1); } }  static void main(String... args); static T parseCommandLine(String[] args);  }
@Test public void testMain() throws Exception { CommandCreateBucket cl = Main.parseCommandLine(new String[]{"createbucket", "--bucket", "foo"}); System.out.println("res:" + cl); assertEquals("foo", cl.bucket); assertEquals("localhost:2181", cl.zk); }