@Test public void testNoPropertiesFileArgumentOrOption() { expectedException.expect(RuntimeException.class); expectedException.expectMessage(equalTo("Properties file missing, please provide a properties file")); MultiLangDaemon.MultiLangDaemonArguments arguments = new MultiLangDaemon.MultiLangDaemonArguments(); daemon.propertiesFile(arguments); }
String propertiesFile(final MultiLangDaemonArguments arguments) { String propertiesFile = ""; if (CollectionUtils.isNotEmpty(arguments.parameters)) { if (arguments.parameters.size() == 1) { propertiesFile = arguments.parameters.get(0); } else { throw new RuntimeException( "Expected a single argument, but found multiple arguments. Arguments: " + String.join(", ", arguments.parameters)); } } if (StringUtils.isNotEmpty(arguments.propertiesFile)) { if (StringUtils.isNotEmpty(propertiesFile)) { log.warn("Overriding the properties file with the --properties-file option"); } propertiesFile = arguments.propertiesFile; } if (StringUtils.isEmpty(propertiesFile)) { throw new RuntimeException("Properties file missing, please provide a properties file"); } return propertiesFile; }
MultiLangDaemon { String propertiesFile(final MultiLangDaemonArguments arguments) { String propertiesFile = ""; if (CollectionUtils.isNotEmpty(arguments.parameters)) { if (arguments.parameters.size() == 1) { propertiesFile = arguments.parameters.get(0); } else { throw new RuntimeException( "Expected a single argument, but found multiple arguments. Arguments: " + String.join(", ", arguments.parameters)); } } if (StringUtils.isNotEmpty(arguments.propertiesFile)) { if (StringUtils.isNotEmpty(propertiesFile)) { log.warn("Overriding the properties file with the --properties-file option"); } propertiesFile = arguments.propertiesFile; } if (StringUtils.isEmpty(propertiesFile)) { throw new RuntimeException("Properties file missing, please provide a properties file"); } return propertiesFile; } }
MultiLangDaemon { String propertiesFile(final MultiLangDaemonArguments arguments) { String propertiesFile = ""; if (CollectionUtils.isNotEmpty(arguments.parameters)) { if (arguments.parameters.size() == 1) { propertiesFile = arguments.parameters.get(0); } else { throw new RuntimeException( "Expected a single argument, but found multiple arguments. Arguments: " + String.join(", ", arguments.parameters)); } } if (StringUtils.isNotEmpty(arguments.propertiesFile)) { if (StringUtils.isNotEmpty(propertiesFile)) { log.warn("Overriding the properties file with the --properties-file option"); } propertiesFile = arguments.propertiesFile; } if (StringUtils.isEmpty(propertiesFile)) { throw new RuntimeException("Properties file missing, please provide a properties file"); } return propertiesFile; }  }
MultiLangDaemon { String propertiesFile(final MultiLangDaemonArguments arguments) { String propertiesFile = ""; if (CollectionUtils.isNotEmpty(arguments.parameters)) { if (arguments.parameters.size() == 1) { propertiesFile = arguments.parameters.get(0); } else { throw new RuntimeException( "Expected a single argument, but found multiple arguments. Arguments: " + String.join(", ", arguments.parameters)); } } if (StringUtils.isNotEmpty(arguments.propertiesFile)) { if (StringUtils.isNotEmpty(propertiesFile)) { log.warn("Overriding the properties file with the --properties-file option"); } propertiesFile = arguments.propertiesFile; } if (StringUtils.isEmpty(propertiesFile)) { throw new RuntimeException("Properties file missing, please provide a properties file"); } return propertiesFile; }  static void main(final String[] args); }
MultiLangDaemon { String propertiesFile(final MultiLangDaemonArguments arguments) { String propertiesFile = ""; if (CollectionUtils.isNotEmpty(arguments.parameters)) { if (arguments.parameters.size() == 1) { propertiesFile = arguments.parameters.get(0); } else { throw new RuntimeException( "Expected a single argument, but found multiple arguments. Arguments: " + String.join(", ", arguments.parameters)); } } if (StringUtils.isNotEmpty(arguments.propertiesFile)) { if (StringUtils.isNotEmpty(propertiesFile)) { log.warn("Overriding the properties file with the --properties-file option"); } propertiesFile = arguments.propertiesFile; } if (StringUtils.isEmpty(propertiesFile)) { throw new RuntimeException("Properties file missing, please provide a properties file"); } return propertiesFile; }  static void main(final String[] args);  }