DefaultApplicationMain { @VisibleForTesting static void run(String[] args) { final ApplicationRunnerMain.ApplicationRunnerCommandLine cmdLine = new ApplicationRunnerMain.ApplicationRunnerCommandLine(); cmdLine.parser().allowsUnrecognizedOptions(); final OptionSet options = cmdLine.parser().parse(args); final Config originalConfig = ConfigUtil.loadConfig(cmdLine.loadConfig(options)); JobCoordinatorLaunchUtil.run(ApplicationUtil.fromConfig(originalConfig), originalConfig); }  static void main(String[] args);  }
@Test public void testRun() throws Exception { String[] args = new String[] { "--config", JobConfig.CONFIG_LOADER_FACTORY + "=" + PropertiesConfigLoaderFactory.class.getName(), "--config", PropertiesConfigLoaderFactory.CONFIG_LOADER_PROPERTIES_PREFIX + "path=" + getClass().getResource("/test.properties").getPath() }; StreamApplication mockApplication = mock(StreamApplication.class); Config mockConfig = mock(Config.class); mockStatic(JobCoordinatorLaunchUtil.class, ApplicationUtil.class, ConfigUtil.class); when(ApplicationUtil.fromConfig(any())) .thenReturn(mockApplication); when(ConfigUtil.loadConfig(any())) .thenReturn(mockConfig); doNothing() .when(JobCoordinatorLaunchUtil.class, "run", mockApplication, mockConfig); DefaultApplicationMain.run(args); verifyStatic(times(1)); JobCoordinatorLaunchUtil.run(mockApplication, mockConfig); }