@Test public void testToHelpString() { final Options options = AnalyzeCommand.createOptions(); final AbstractCharSequenceAssert<?, String> sequenceAssert = assertThat(AnalyzeCommand.toHelpString(options)) .isNotBlank() .containsIgnoringCase("Jarviz") .containsIgnoringCase("Exit status:"); for (Option o : options.getOptions()) { sequenceAssert.contains("-" + o.getOpt()); sequenceAssert.contains("--" + o.getLongOpt()); } }
static String toHelpString(final Options options) { final StringBuilder b = new StringBuilder(); b.append("Jarviz Dependency Analyser\n"); b.append("--------------------------\n"); b.append("Jarviz is a dependency analysis tool for Java and it can generate a couplings graph between selected methods.\n"); b.append("It analyzes the bytecode from Java artifacts to find out the dependencies. The generated couplings graph\n"); b.append("is saved in to a newline-delimited JSON file as the output.\n"); b.append('\n'); b.append("Analyze Command\n"); b.append("---------------\n"); b.append("The following options are available:\n"); final List<Option> optionList = new ArrayList<>(options.getOptions()); final List<String> paddedParams = toPaddedStrings( optionList.stream() .map(o -> String.format("-%s, --%s %s", o.getOpt(), o.getLongOpt(), o.hasArg() ? " <arg>" : "")) .collect(Collectors.toList()) ); for (int i = 0; i < optionList.size(); i++) { final Option o = optionList.get(i); b.append(' ').append(paddedParams.get(i)).append(" ").append(o.getDescription()).append('\n'); } b.append('\n'); b.append("Exit status:\n"); b.append(" 0 if successful\n"); b.append(String.format(" %d if cli initialization failed\n", ExitStatus.CLI_INIT_FAILED)); b.append(String.format(" %d if analyser failed\n", ExitStatus.ANALYSER_FAILED)); findImplementationVersion().ifPresent(v -> b.append(String.format("\nVersion: %s\n", v))); return b.toString(); }
AnalyzeCommand { static String toHelpString(final Options options) { final StringBuilder b = new StringBuilder(); b.append("Jarviz Dependency Analyser\n"); b.append("--------------------------\n"); b.append("Jarviz is a dependency analysis tool for Java and it can generate a couplings graph between selected methods.\n"); b.append("It analyzes the bytecode from Java artifacts to find out the dependencies. The generated couplings graph\n"); b.append("is saved in to a newline-delimited JSON file as the output.\n"); b.append('\n'); b.append("Analyze Command\n"); b.append("---------------\n"); b.append("The following options are available:\n"); final List<Option> optionList = new ArrayList<>(options.getOptions()); final List<String> paddedParams = toPaddedStrings( optionList.stream() .map(o -> String.format("-%s, --%s %s", o.getOpt(), o.getLongOpt(), o.hasArg() ? " <arg>" : "")) .collect(Collectors.toList()) ); for (int i = 0; i < optionList.size(); i++) { final Option o = optionList.get(i); b.append(' ').append(paddedParams.get(i)).append(" ").append(o.getDescription()).append('\n'); } b.append('\n'); b.append("Exit status:\n"); b.append(" 0 if successful\n"); b.append(String.format(" %d if cli initialization failed\n", ExitStatus.CLI_INIT_FAILED)); b.append(String.format(" %d if analyser failed\n", ExitStatus.ANALYSER_FAILED)); findImplementationVersion().ifPresent(v -> b.append(String.format("\nVersion: %s\n", v))); return b.toString(); } }
AnalyzeCommand { static String toHelpString(final Options options) { final StringBuilder b = new StringBuilder(); b.append("Jarviz Dependency Analyser\n"); b.append("--------------------------\n"); b.append("Jarviz is a dependency analysis tool for Java and it can generate a couplings graph between selected methods.\n"); b.append("It analyzes the bytecode from Java artifacts to find out the dependencies. The generated couplings graph\n"); b.append("is saved in to a newline-delimited JSON file as the output.\n"); b.append('\n'); b.append("Analyze Command\n"); b.append("---------------\n"); b.append("The following options are available:\n"); final List<Option> optionList = new ArrayList<>(options.getOptions()); final List<String> paddedParams = toPaddedStrings( optionList.stream() .map(o -> String.format("-%s, --%s %s", o.getOpt(), o.getLongOpt(), o.hasArg() ? " <arg>" : "")) .collect(Collectors.toList()) ); for (int i = 0; i < optionList.size(); i++) { final Option o = optionList.get(i); b.append(' ').append(paddedParams.get(i)).append(" ").append(o.getDescription()).append('\n'); } b.append('\n'); b.append("Exit status:\n"); b.append(" 0 if successful\n"); b.append(String.format(" %d if cli initialization failed\n", ExitStatus.CLI_INIT_FAILED)); b.append(String.format(" %d if analyser failed\n", ExitStatus.ANALYSER_FAILED)); findImplementationVersion().ifPresent(v -> b.append(String.format("\nVersion: %s\n", v))); return b.toString(); }  }
AnalyzeCommand { static String toHelpString(final Options options) { final StringBuilder b = new StringBuilder(); b.append("Jarviz Dependency Analyser\n"); b.append("--------------------------\n"); b.append("Jarviz is a dependency analysis tool for Java and it can generate a couplings graph between selected methods.\n"); b.append("It analyzes the bytecode from Java artifacts to find out the dependencies. The generated couplings graph\n"); b.append("is saved in to a newline-delimited JSON file as the output.\n"); b.append('\n'); b.append("Analyze Command\n"); b.append("---------------\n"); b.append("The following options are available:\n"); final List<Option> optionList = new ArrayList<>(options.getOptions()); final List<String> paddedParams = toPaddedStrings( optionList.stream() .map(o -> String.format("-%s, --%s %s", o.getOpt(), o.getLongOpt(), o.hasArg() ? " <arg>" : "")) .collect(Collectors.toList()) ); for (int i = 0; i < optionList.size(); i++) { final Option o = optionList.get(i); b.append(' ').append(paddedParams.get(i)).append(" ").append(o.getDescription()).append('\n'); } b.append('\n'); b.append("Exit status:\n"); b.append(" 0 if successful\n"); b.append(String.format(" %d if cli initialization failed\n", ExitStatus.CLI_INIT_FAILED)); b.append(String.format(" %d if analyser failed\n", ExitStatus.ANALYSER_FAILED)); findImplementationVersion().ifPresent(v -> b.append(String.format("\nVersion: %s\n", v))); return b.toString(); }  static void main(String[] args); }
AnalyzeCommand { static String toHelpString(final Options options) { final StringBuilder b = new StringBuilder(); b.append("Jarviz Dependency Analyser\n"); b.append("--------------------------\n"); b.append("Jarviz is a dependency analysis tool for Java and it can generate a couplings graph between selected methods.\n"); b.append("It analyzes the bytecode from Java artifacts to find out the dependencies. The generated couplings graph\n"); b.append("is saved in to a newline-delimited JSON file as the output.\n"); b.append('\n'); b.append("Analyze Command\n"); b.append("---------------\n"); b.append("The following options are available:\n"); final List<Option> optionList = new ArrayList<>(options.getOptions()); final List<String> paddedParams = toPaddedStrings( optionList.stream() .map(o -> String.format("-%s, --%s %s", o.getOpt(), o.getLongOpt(), o.hasArg() ? " <arg>" : "")) .collect(Collectors.toList()) ); for (int i = 0; i < optionList.size(); i++) { final Option o = optionList.get(i); b.append(' ').append(paddedParams.get(i)).append(" ").append(o.getDescription()).append('\n'); } b.append('\n'); b.append("Exit status:\n"); b.append(" 0 if successful\n"); b.append(String.format(" %d if cli initialization failed\n", ExitStatus.CLI_INIT_FAILED)); b.append(String.format(" %d if analyser failed\n", ExitStatus.ANALYSER_FAILED)); findImplementationVersion().ifPresent(v -> b.append(String.format("\nVersion: %s\n", v))); return b.toString(); }  static void main(String[] args);  }