@Test
  public void testVerifyRepositories() throws Exception {
    // member state mocks
    Injector injector = createStrictMock(Injector.class);
    Capture<AmbariManagementController> controllerCapture = EasyMock.newCapture();

    // expectations
    // constructor init
    constructorInit(injector, controllerCapture, createNiceMock(KerberosHelper.class));

    Configuration configuration = createNiceMock(Configuration.class);
    String[] suffices = {"/repodata/repomd.xml"};
    expect(configuration.getRepoValidationSuffixes("redhat6")).andReturn(suffices);

    // replay mocks
    replay(injector, clusters, ambariMetaInfo, configuration);

    // test
    AmbariManagementController controller = new AmbariManagementControllerImpl(null, clusters, injector);
    setAmbariMetaInfo(ambariMetaInfo, controller);

    // Manually injected
    Class<?> c = controller.getClass();
    Field f = c.getDeclaredField("configs");
    f.setAccessible(true);
    f.set(controller, configuration);

    Set<RepositoryRequest> requests = new HashSet<>();
    RepositoryRequest request = new RepositoryRequest("stackName", "stackVersion", "redhat6", "repoId", "repo_name");
    request.setBaseUrl("file:///some/repo");
    requests.add(request);

    // A wrong file path is passed and IllegalArgumentException is expected
    try {
      controller.verifyRepositories(requests);
      Assert.fail("IllegalArgumentException is expected");
    } catch (IllegalArgumentException e) {
      Assert.assertEquals("Could not access base url . file:///some/repo/repodata/repomd.xml . ", e.getMessage());
    }

    verify(injector, clusters, ambariMetaInfo, configuration);
  }
Ensure that RollbackException is thrown outside the updateClusters method
when a unique constraint violation occurs.
ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java