@Test public void testAddServiceReposToOperatingSystemEntities_RepoAlreadExists() {

  List<OperatingSystemEntity> operatingSystems = new ArrayList<>();
  for (String os: OPERATING_SYSTEMS) {
    RepositoryEntity repo1 = repoEntity("HDP", "HDP-2.3", "http://hdp.org/2.3");
    RepositoryEntity repo2 = repoEntity("HDP-UTILS", "HDP-UTILS-1.1.0", "http://hdp.org/utils/1.1.0");
    RepositoryEntity repo3 = repoEntity("MSFT_R", "MSFT_R-8.1", "http://msft.r.ORIGINAL");
    operatingSystems.add(osEntity(os, repo1, repo2, repo3));
  }
  ListMultimap<String, RepositoryInfo> serviceRepos = serviceRepos(ImmutableList.of("redhat6"),
      "MSFT_R", "MSFT_R-8.2", "http://msft.r.NEW");
  RepoUtil.addServiceReposToOperatingSystemEntities(operatingSystems, serviceRepos);
  // Verify results. Service repo should not be added second time.
  for (OperatingSystemEntity os: operatingSystems) {
    Optional<RepositoryEntity> msft_r_orig = findRepoEntityById(os.getRepositories(), "MSFT_R-8.1");
    Optional<RepositoryEntity> msft_r_new = findRepoEntityById(os.getRepositories(), "MSFT_R-8.2");
    Assert.assertTrue("Original repo is missing", msft_r_orig.isPresent());
    Assert.assertTrue("Service repo with duplicate name should not have been added", !msft_r_new.isPresent());
  }
}