### Question:
QuorumPeerConfig { private boolean parseBoolean(String key, String value) throws ConfigException { if (value.equalsIgnoreCase("true")) { return true; } else if (value.equalsIgnoreCase("false")) { return false; } else { throw new ConfigException("Invalid option " + value + " for " + key + ". Choose 'true' or 'false.'"); } }  void parse(String path); static String getVersionFromFilename(String filename); void parseProperties(Properties zkProp); static void configureSSLAuth(); static void writeDynamicConfig(final String dynamicConfigFilename, final QuorumVerifier qv, final boolean needKeepVersion); static void editStaticConfig(final String configFileStr, final String dynamicFileStr, final boolean eraseClientPortAddress); static void deleteFile(String filename); static QuorumVerifier parseDynamicConfig(Properties dynamicConfigProp, int eAlg, boolean warnings, boolean configBackwardCompatibilityMode); void checkValidity(); InetSocketAddress getClientPortAddress(); InetSocketAddress getSecureClientPortAddress(); int getObserverMasterPort(); File getDataDir(); File getDataLogDir(); String getInitialConfig(); int getTickTime(); int getMaxClientCnxns(); int getMinSessionTimeout(); int getMaxSessionTimeout(); String getMetricsProviderClassName(); Properties getMetricsProviderConfiguration(); boolean areLocalSessionsEnabled(); boolean isLocalSessionsUpgradingEnabled(); boolean isSslQuorum(); boolean shouldUsePortUnification(); int getClientPortListenBacklog(); int getInitLimit(); int getSyncLimit(); int getConnectToLearnerMasterLimit(); int getElectionAlg(); int getElectionPort(); int getSnapRetainCount(); int getPurgeInterval(); boolean getSyncEnabled(); QuorumVerifier getQuorumVerifier(); QuorumVerifier getLastSeenQuorumVerifier(); Map<Long, QuorumServer> getServers(); long getJvmPauseInfoThresholdMs(); long getJvmPauseWarnThresholdMs(); long getJvmPauseSleepTimeMs(); boolean isJvmPauseMonitorToRun(); long getServerId(); boolean isDistributed(); LearnerType getPeerType(); String getConfigFilename(); Boolean getQuorumListenOnAllIPs(); boolean isMultiAddressEnabled(); boolean isMultiAddressReachabilityCheckEnabled(); int getMultiAddressReachabilityCheckTimeoutMs(); static boolean isStandaloneEnabled(); static void setStandaloneEnabled(boolean enabled); static boolean isReconfigEnabled(); static void setReconfigEnabled(boolean enabled); static final String nextDynamicConfigFileSuffix; }### Answer:
@Test public void testParseBoolean() throws IOException, ConfigException { QuorumPeerConfig quorumPeerConfig = new QuorumPeerConfig(); Properties zkProp = getDefaultZKProperties(); zkProp.setProperty("localSessionsEnabled", "true"); quorumPeerConfig.parseProperties(zkProp); assertEquals(true, quorumPeerConfig.areLocalSessionsEnabled()); zkProp.setProperty("localSessionsEnabled", "false"); quorumPeerConfig.parseProperties(zkProp); assertEquals(false, quorumPeerConfig.areLocalSessionsEnabled()); zkProp.setProperty("localSessionsEnabled", "True"); quorumPeerConfig.parseProperties(zkProp); assertEquals(true, quorumPeerConfig.areLocalSessionsEnabled()); zkProp.setProperty("localSessionsEnabled", "False"); quorumPeerConfig.parseProperties(zkProp); assertEquals(false, quorumPeerConfig.areLocalSessionsEnabled()); zkProp.setProperty("localSessionsEnabled", "yes"); try { quorumPeerConfig.parseProperties(zkProp); fail("Must throw exception as 'yes' is not accpetable for parseBoolean!"); } catch (ConfigException e) { } }