@Test
 public void shouldNotCreatePackageRepositoryWhenRepositoryWithSpecifiedNameAlreadyExists()
     throws Exception {
   CreatePackageRepositoryCommand command =
       new CreatePackageRepositoryCommand(
           goConfigService, packageRepositoryService, packageRepository, currentUser, result);
   command.update(cruiseConfig);
   assertFalse(command.isValid(cruiseConfig));
   assertThat(
       packageRepository.errors().firstError(),
       is(
           "You have defined multiple repositories called 'npmOrg'. Repository names are case-insensitive and must be unique."));
 }
  @Test
  public void shouldCreatePackageRepository() throws Exception {
    PackageRepository repository =
        new PackageRepository("id", "name", new PluginConfiguration(), new Configuration());
    CreatePackageRepositoryCommand command =
        new CreatePackageRepositoryCommand(
            goConfigService, packageRepositoryService, repository, currentUser, result);

    assertNull(cruiseConfig.getPackageRepositories().find("id"));
    command.update(cruiseConfig);
    HttpLocalizedOperationResult expectedResult = new HttpLocalizedOperationResult();
    assertThat(result, is(expectedResult));
    assertThat(cruiseConfig.getPackageRepositories().find("id"), is(repository));
  }