CitrusApp { public static void main(String[] args) { CitrusApp citrusApp = new CitrusApp(args); if (citrusApp.configuration.getTimeToLive() > 0) { CompletableFuture.runAsync(() -> { try { new CompletableFuture<Void>().get(citrusApp.configuration.getTimeToLive(), TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { log.info(String.format("Shutdown Citrus application after %s ms", citrusApp.configuration.getTimeToLive())); citrusApp.stop(); } }); } if (citrusApp.configuration.isSkipTests()) { if (citrusApp.configuration.getConfigClass() != null) { Citrus.newInstance(CitrusSpringContext.create(citrusApp.configuration.getConfigClass())); } else { Citrus.newInstance(); } setDefaultProperties(citrusApp.configuration); } else { try { citrusApp.run(); } finally { if (citrusApp.configuration.getTimeToLive() == 0) { citrusApp.stop(); } } } if (citrusApp.configuration.isSystemExit()) { if (citrusApp.waitForCompletion()) { System.exit(0); } else { System.exit(-1); } } else { citrusApp.waitForCompletion(); } } CitrusApp();  CitrusApp(CitrusAppConfiguration configuration);  CitrusApp(String[] args); static void main(String[] args); void run(); void complete(); boolean waitForCompletion(); boolean isCompleted();  }
@Test public void testHelpOption() { CitrusApp.main(new String[] { "-h" }); CitrusApp.main(new String[] { "--help" }); }
@Test public void testDurationOption() { CitrusApp.main(new String[] { "-s", "true", "-d", "200" }); CitrusApp.main(new String[] { "-s", "true", "--duration", "200" }); try { CitrusApp.main(new String[] { "-s", "true", "-d" }); Assert.fail("Missing exception due to invalid option parameter usage"); } catch (CitrusRuntimeException e) { Assert.assertEquals(e.getMessage(), "Missing parameter value for -d/--duration option"); } }
@Test public void testConfigClassOption() { CitrusApp.main(new String[] { "-s", "true", "-d", "200", "-c", CustomConfig.class.getName() }); CitrusApp.main(new String[] { "-s", "true", "-d", "200", "--config", CustomConfig.class.getName() }); try { CitrusApp.main(new String[] { "-s", "true", "-d", "200", "--config" }); Assert.fail("Missing exception due to invalid option parameter usage"); } catch (CitrusRuntimeException e) { Assert.assertEquals(e.getMessage(), "Missing parameter value for -c/--config option"); } try { CitrusApp.main(new String[] { "-s", "true", "-c", "unknown.Class" }); Assert.fail("Missing exception due to invalid option parameter usage"); } catch (CitrusRuntimeException e) { Assert.assertEquals(e.getCause().getClass(), ClassNotFoundException.class); } }