RetryCommand extends Command { @Override public boolean shouldShowUsage() { int indexOfCommandParameter = getIndexOfCommandParameter(); int indexOfHelpParameter = getIndexOfHelpParameter(); return (indexOfHelpParameter >= 0 && (indexOfHelpParameter < indexOfCommandParameter || indexOfCommandParameter == -1)); }  @Override void execute(); @Override boolean shouldShowUsage();  }
@Test public void shouldShowUsageHelp() { retryCommandSpy.originalArgs = Arrays.asList("retry", "-h", "-d", "tmp", "-c", "ls", "-al"); assertTrue(retryCommandSpy.shouldShowUsage()); }
@Test public void shouldShowUsageHelpMissingCommand() { retryCommandSpy.originalArgs = Arrays.asList("retry", "-h", "-d", "tmp", "ls", "-al"); assertTrue(retryCommandSpy.shouldShowUsage()); }
@Test public void shouldShowUsageHelpNo() { retryCommandSpy.originalArgs = Arrays.asList("retry", "-d", "tmp", "-c", "ls", "-al"); assertFalse(retryCommandSpy.shouldShowUsage()); }