CliStarter { public void run() { Performable performable = null; final Optional<String> command = this.arguments.getCommand(); if (!command.isPresent()) { throw new IllegalStateException("Command missing trying to execute OFT mode."); } switch (command.get()) { case ConvertCommand.COMMAND_NAME: performable = new ConvertCommand(this.arguments); break; case TraceCommand.COMMAND_NAME: performable = new TraceCommand(this.arguments); break; default: throw new IllegalStateException( "Unknown command '" + command.get() + "' trying to execute OFT mode."); } if (performable.run()) { exit(ExitStatus.OK); } else { exit(ExitStatus.FAILURE); } } CliStarter(final CliArguments arguments); static void main(final String[] args); static void main(final String[] args, final DirectoryService directoryService); void run();  }
@Test void testRunWithoutArguments() { AssertExit.assertExitWithStatus(2, () -> run(asList())); }
@Test void testRunThrowingException() { final ExporterException exception = assertThrows(ExporterException.class, () -> run(asList("trace"))); assertThat(exception.getMessage(), equalTo("Found no matching reporter for output format 'plain'")); }
@Test void testRunWithUnknownCommand() { AssertExit.assertExitWithStatus(2, () -> run(asList("unknownCommand"))); }