CDILauncher { public static void main(final String[] args) { final SeContainerInitializer initializer = SeContainerInitializer.newInstance(); final Config config = configure(initializer, args); try (final SeContainer container = initializer.initialize()) { if (config.main != null) { executeMain(config, container); } } } private  CDILauncher(); static void main(final String[] args);  }
@Test public void namedRunnable() { assertFalse(MyRunnable.ran); CDILauncher.main(new String[]{ "--openwebbeans.main", "main", "--openwebbeans.disableDiscovery", "true", "--openwebbeans.classes", MyRunnable.class.getName() }); assertTrue(MyRunnable.ran); }
@Test public void typedRunnable() { assertFalse(MyRunnable2.ran); CDILauncher.main(new String[]{ "--openwebbeans.main", MyRunnable2.class.getName(), "--openwebbeans.disableDiscovery", "true", "--openwebbeans.classes", MyRunnable2.class.getName() }); assertTrue(MyRunnable2.ran); }
@Test public void mainArgs() { assertNull(MyMain.args); CDILauncher.main(new String[]{ "--openwebbeans.main", MyMain.class.getName(), "--openwebbeans.disableDiscovery", "true", "--openwebbeans.classes", MyMain.class.getName(), "--other", "yes", "and", "args" }); assertArrayEquals(new String[]{ "--other", "yes", "and", "args" }, MyMain.args); }