@Test
public void testVerifyRepositories() throws Exception {

  // member state mocks
  Injector injector = createStrictMock(Injector.class);
  Capture<AmbariManagementController> controllerCapture = EasyMock.newCapture();
  // expectations
  // constructor init
  injector.injectMembers(capture(controllerCapture));
  expect(injector.getInstance(Gson.class)).andReturn(null);
  expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(null);
  expect(injector.getInstance(KerberosHelper.class)).andReturn(createNiceMock(KerberosHelper.class));
  RepositoryInfo dummyRepoInfo = new RepositoryInfo();
  dummyRepoInfo.setRepoName("repo_name");
  expect(ambariMetaInfo.getRepository("stackName", "stackVersion", "redhat6", "repoId")).andReturn(dummyRepoInfo);
  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>();
  RepositoryRequest request = new RepositoryRequest("stackName", "stackVersion", "redhat6", "repoId");
  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);
}