### Question:
CatalogTracker { public boolean verifyRootRegionLocation(final long timeout) throws InterruptedException, IOException { HRegionInterface connection = null; try { connection = waitForRootServerConnection(timeout); } catch (NotAllMetaRegionsOnlineException e) { } catch (org.apache.hadoop.hbase.ipc.ServerNotRunningException e) { } catch (IOException e) { throw e; } return (connection == null)? false: verifyRegionLocation(connection,this.rootRegionTracker.getRootRegionLocation(), HRegionInfo.ROOT_REGIONINFO.getRegionName()); } CatalogTracker(final HConnection connection);  CatalogTracker(final ZooKeeperWatcher zk, final HConnection connection,
      final Abortable abortable);  CatalogTracker(final ZooKeeperWatcher zk, final HConnection connection,
      final Abortable abortable, final int defaultTimeout); void start(); void stop(); HServerAddress getRootLocation(); HServerAddress getMetaLocation(); void waitForRoot(); HRegionInterface waitForRootServerConnection(long timeout); HRegionInterface waitForRootServerConnectionDefault(); void waitForMeta(); HServerAddress waitForMeta(long timeout); HRegionInterface waitForMetaServerConnection(long timeout); HRegionInterface waitForMetaServerConnectionDefault(); boolean verifyRootRegionLocation(final long timeout); boolean verifyMetaRegionLocation(final long timeout); HConnection getConnection(); static final byte [] ROOT_REGION; static final byte [] META_REGION; }### 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((HServerAddress)Matchers.anyObject(), Matchers.anyBoolean())). thenReturn(implementation); Assert.assertNotNull(connection.getHRegionConnection(new HServerAddress(), false)); final CatalogTracker ct = constructAndStartCatalogTracker(connection); try { RootLocationEditor.setRootLocation(this.watcher, new HServerAddress("example.com:1234")); Assert.assertFalse(ct.verifyRootRegionLocation(100)); } finally { RootLocationEditor.deleteRootLocation(this.watcher); } }