RepoUpdateCommand extends RepoCommand { public void checkRepositoryParams() throws CommandException { if (repositoryNames == null && nameParam == null) { throw new CommandException("Must provide one of the following options: --name, --repositoryNames"); } else if (repositoryNames != null && (nameParam != null || newNameParam != null)) { throw new CommandException("Can't use --repository-names option with --name or --new-name options"); } }  void checkRepositoryParams(); @Override void execute(); void updateRepositoriesForRepositoryNames();  }
@Test(expected = CommandException.class) public void testConflictingParameters() throws CommandException { RepoUpdateCommand repoUpdateCommand = new RepoUpdateCommand(); repoUpdateCommand.nameParam = "repo1"; repoUpdateCommand.repositoryNames = Arrays.asList("repo2"); repoUpdateCommand.checkRepositoryParams(); }