### Question:
CatalogTracker { public boolean verifyRootRegionLocation(final long timeout) throws InterruptedException, IOException { HRegionInterface connection = null; try { connection = waitForRootServerConnection(timeout); } catch (NotAllMetaRegionsOnlineException e) { } catch (ServerNotRunningYetException e) { } catch (UnknownHostException e) { } return (connection == null)? false: verifyRegionLocation(connection, this.rootRegionTracker.getRootRegionLocation(), ROOT_REGION_NAME); } CatalogTracker(final Configuration conf);  CatalogTracker(final ZooKeeperWatcher zk, final Configuration conf,
      Abortable abortable);   CatalogTracker(final ZooKeeperWatcher zk, final Configuration conf,
      HConnection connection, Abortable abortable); void start(); void stop(); ServerName getRootLocation(); ServerName getMetaLocation(); ServerName getMetaLocationOrReadLocationFromRoot(); void waitForRoot(); HRegionInterface waitForRootServerConnection(long timeout); void waitForMeta(); ServerName waitForMeta(long timeout); HRegionInterface waitForMetaServerConnection(long timeout); void resetMetaLocation(); boolean verifyRootRegionLocation(final long timeout); boolean verifyMetaRegionLocation(final long timeout); HConnection getConnection();  }### Answer:
@Test public void testVerifyRootRegionLocationFails() throws IOException, InterruptedException, KeeperException { HConnection connection = Mockito.mock(HConnection.class); ConnectException connectException = new ConnectException("Connection refused"); final HRegionInterface implementation = Mockito.mock(HRegionInterface.class); Mockito.when(implementation.getRegionInfo((byte [])Mockito.any())). thenThrow(connectException); Mockito.when(connection.getHRegionConnection(Mockito.anyString(), Mockito.anyInt(), Mockito.anyBoolean())). thenReturn(implementation); final CatalogTracker ct = constructAndStartCatalogTracker(connection); try { RootLocationEditor.setRootLocation(this.watcher, new ServerName("example.com", 1234, System.currentTimeMillis())); Assert.assertFalse(ct.verifyRootRegionLocation(100)); } finally { RootLocationEditor.deleteRootLocation(this.watcher); } }