### Question:
ZooConfigurationFactory { ZooConfiguration getInstance(ServerContext context, ZooCacheFactory zcf, AccumuloConfiguration parent) { ZooConfiguration config; synchronized (instances) { config = instances.get(context.getInstanceID()); if (config == null) { ZooCache propCache; Watcher watcher = new Watcher() { @Override public void process(WatchedEvent arg0) {} }; propCache = zcf.getZooCache(context.getZooKeepers(), context.getZooKeepersSessionTimeOut(), watcher); config = new ZooConfiguration(context, propCache, parent); instances.put(context.getInstanceID(), config); } } return config; }    }### Answer:
@Test public void testGetInstance() { expect(context.getZooKeeperRoot()).andReturn("zkroot").anyTimes(); expect(context.getInstanceID()).andReturn("iid").anyTimes(); expect(context.getZooKeepers()).andReturn("localhost").anyTimes(); expect(context.getZooKeepersSessionTimeOut()).andReturn(120000).anyTimes(); replay(context); expect(zcf.getZooCache(eq("localhost"), eq(120000), isA(Watcher.class))).andReturn(zc) .anyTimes(); replay(zcf); ZooConfiguration c = zconff.getInstance(context, zcf, parent); assertNotNull(c); assertSame(c, zconff.getInstance(context, zcf, parent)); verify(context); verify(zcf); }