### Question:
HS2ZookeeperURLManager extends DefaultURLManager { @Override public synchronized void markFailed(String url) { failedSet.add(url); if (failedSet.size() >= getURLs().size()) { failedSet.clear(); setURLs(lookupURLs()); } super.markFailed(url); } HS2ZookeeperURLManager(); @Override boolean supportsConfig(HaServiceConfig config); @Override void setConfig(HaServiceConfig config); List<String> lookupURLs(); @Override synchronized void markFailed(String url);  }### Answer:
@Test public void testActiveURLManagement() throws Exception { List<String> urls = manager.getURLs(); Assert.assertNotNull(urls); String url1 = urls.get( 0 ); String url2 = urls.get( 1 ); String url3 = urls.get( 2 ); assertEquals(url1, urls.get(0)); assertEquals(url1, manager.getActiveURL()); manager.markFailed(url1); assertEquals(url2, manager.getActiveURL()); manager.markFailed(url2); assertEquals(url3, manager.getActiveURL()); }
@Test public void testMarkingFailedURL() { List<String> urls = manager.getURLs(); String url1 = urls.get(0); urls.add(url1); String url2 = urls.get(1); urls.add(url2); String url3 = urls.get(2); urls.add(url3); String url4 = urls.get(3); urls.add(url4); assertEquals(url1, manager.getActiveURL()); manager.markFailed(url1); assertEquals(url2, manager.getActiveURL()); manager.markFailed(url1); assertEquals(url2, manager.getActiveURL()); manager.markFailed(url3); assertEquals(url2, manager.getActiveURL()); manager.markFailed(url4); assertEquals(url2, manager.getActiveURL()); manager.markFailed(url2); assertEquals(url1, manager.getActiveURL()); }