@Test public void setActiveDatabase() throws CommandException { cmd.execute("db1"); verify(mockShell).setActiveDatabase("db1"); }
@Override public void execute(@Nonnull final String argString) throws ExitException, CommandException { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); String databaseName = args.length == 0 ? DatabaseManager.ABSENT_DB_NAME : args[0]; databaseManager.setActiveDatabase(databaseName); }
Use implements Command { @Override public void execute(@Nonnull final String argString) throws ExitException, CommandException { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); String databaseName = args.length == 0 ? DatabaseManager.ABSENT_DB_NAME : args[0]; databaseManager.setActiveDatabase(databaseName); } }
Use implements Command { @Override public void execute(@Nonnull final String argString) throws ExitException, CommandException { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); String databaseName = args.length == 0 ? DatabaseManager.ABSENT_DB_NAME : args[0]; databaseManager.setActiveDatabase(databaseName); } Use(@Nonnull final DatabaseManager databaseManager); }
Use implements Command { @Override public void execute(@Nonnull final String argString) throws ExitException, CommandException { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); String databaseName = args.length == 0 ? DatabaseManager.ABSENT_DB_NAME : args[0]; databaseManager.setActiveDatabase(databaseName); } Use(@Nonnull final DatabaseManager databaseManager); @Nonnull @Override String getName(); @Nonnull @Override String getDescription(); @Nonnull @Override String getUsage(); @Nonnull @Override String getHelp(); @Nonnull @Override List<String> getAliases(); @Override void execute(@Nonnull final String argString); }
Use implements Command { @Override public void execute(@Nonnull final String argString) throws ExitException, CommandException { String[] args = simpleArgParse(argString, 0, 1, COMMAND_NAME, getUsage()); String databaseName = args.length == 0 ? DatabaseManager.ABSENT_DB_NAME : args[0]; databaseManager.setActiveDatabase(databaseName); } Use(@Nonnull final DatabaseManager databaseManager); @Nonnull @Override String getName(); @Nonnull @Override String getDescription(); @Nonnull @Override String getUsage(); @Nonnull @Override String getHelp(); @Nonnull @Override List<String> getAliases(); @Override void execute(@Nonnull final String argString);  }