### Question:
ZooKeeperServerConf { public Map<String, Object> toMap() { Map<String, Object> conf = new LinkedHashMap<String, Object>(); conf.put(KEY_CLIENT_PORT, clientPort); conf.put(KEY_DATA_DIR, dataDir); conf.put(KEY_DATA_LOG_DIR, dataLogDir); conf.put(KEY_TICK_TIME, tickTime); conf.put(KEY_MAX_CLIENT_CNXNS, maxClientCnxnsPerHost); conf.put(KEY_MIN_SESSION_TIMEOUT, minSessionTimeout); conf.put(KEY_MAX_SESSION_TIMEOUT, maxSessionTimeout); conf.put(KEY_SERVER_ID, serverId); conf.put(KEY_CLIENT_PORT_LISTEN_BACKLOG, clientPortListenBacklog); return conf; } ZooKeeperServerConf(int clientPort, String dataDir, String dataLogDir, int tickTime, int maxClientCnxnsPerHost, int minSessionTimeout, int maxSessionTimeout, long serverId, int clientPortListenBacklog); int getClientPort(); String getDataDir(); String getDataLogDir(); int getTickTime(); int getMaxClientCnxnsPerHost(); int getMinSessionTimeout(); int getMaxSessionTimeout(); long getServerId(); int getClientPortListenBacklog(); Map<String, Object> toMap(); static final String KEY_CLIENT_PORT; static final String KEY_DATA_DIR; static final String KEY_DATA_LOG_DIR; static final String KEY_TICK_TIME; static final String KEY_MAX_CLIENT_CNXNS; static final String KEY_MIN_SESSION_TIMEOUT; static final String KEY_MAX_SESSION_TIMEOUT; static final String KEY_SERVER_ID; static final String KEY_CLIENT_PORT_LISTEN_BACKLOG; }### Answer:
@Test public void testToMap() { Map<String, Object> m = c.toMap(); assertEquals(9, m.size()); assertEquals(Integer.valueOf(1), m.get(ZooKeeperServerConf.KEY_CLIENT_PORT)); assertEquals("a", m.get(ZooKeeperServerConf.KEY_DATA_DIR)); assertEquals("b", m.get(ZooKeeperServerConf.KEY_DATA_LOG_DIR)); assertEquals(Integer.valueOf(2), m.get(ZooKeeperServerConf.KEY_TICK_TIME)); assertEquals(Integer.valueOf(3), m.get(ZooKeeperServerConf.KEY_MAX_CLIENT_CNXNS)); assertEquals(Integer.valueOf(4), m.get(ZooKeeperServerConf.KEY_MIN_SESSION_TIMEOUT)); assertEquals(Integer.valueOf(5), m.get(ZooKeeperServerConf.KEY_MAX_SESSION_TIMEOUT)); assertEquals(Long.valueOf(6L), m.get(ZooKeeperServerConf.KEY_SERVER_ID)); assertEquals(Integer.valueOf(7), m.get(ZooKeeperServerConf.KEY_CLIENT_PORT_LISTEN_BACKLOG)); }