### Question:
ZooKeeperInstance implements Instance { @Override public String getInstanceName() { if (instanceName == null) instanceName = InstanceOperationsImpl.lookupInstanceName(zooCache, UUID.fromString(getInstanceID())); return instanceName; } ZooKeeperInstance(String instanceName, String zooKeepers);   ZooKeeperInstance(ClientConfiguration config, ZooCacheFactory zcf);  ZooKeeperInstance(ClientConfiguration config); @Override String getInstanceID(); @Override List<String> getMasterLocations(); @Override String getRootTabletLocation(); @Override String getInstanceName(); @Override String getZooKeepers(); @Override int getZooKeepersSessionTimeOut(); @Override Connector getConnector(String principal, AuthenticationToken token); @Override String toString();  }### Answer:
@Test public void testGetInstanceName() { ClientConfiguration config = createMock(ClientConfiguration.class); mockIdConstruction(config); replay(config); zki = new ZooKeeperInstance(config, zcf); expect(zc.get(Constants.ZROOT + "/" + IID_STRING)).andReturn("yup".getBytes()); List<String> children = new java.util.ArrayList<>(); children.add("child1"); children.add("child2"); expect(zc.getChildren(Constants.ZROOT + Constants.ZINSTANCES)).andReturn(children); expect(zc.get(Constants.ZROOT + Constants.ZINSTANCES + "/child1")) .andReturn(UUID.randomUUID().toString().getBytes(UTF_8)); expect(zc.get(Constants.ZROOT + Constants.ZINSTANCES + "/child2")) .andReturn(IID_STRING.getBytes(UTF_8)); replay(zc); assertEquals("child2", zki.getInstanceName()); }