@Test public void testParseBoolean() { Properties properties; final String param = "param"; final boolean defaultValue = true; try { properties = new Properties(); properties.put(param, Boolean.toString(defaultValue)); final boolean b = ConfigParser.parseBoolean(properties, param); assertEquals(defaultValue, b); } catch (final ExitException e) { fail("value is valid"); } try { properties = new Properties(); properties.put(param, "invalid boolean"); ConfigParser.parseBoolean(properties, param); } catch (final ExitException e) { ; } try { properties = new Properties(); properties.put(param, Boolean.toString(!defaultValue)); final boolean b = ConfigParser.parseBoolean(properties, param, defaultValue); assertEquals(defaultValue, !b); } catch (final ExitException e) { fail("value is valid"); } try { properties = new Properties(); properties.put(param, "invalid boolean"); final boolean b = ConfigParser.parseBoolean(properties, param, defaultValue); assertEquals(defaultValue, b); } catch (final ExitException e) { fail("default value is provided"); } }
public static boolean parseBoolean(final Properties properties, final String param) throws ExitException { return parseBoolean(properties, param, null); }
ConfigParser { public static boolean parseBoolean(final Properties properties, final String param) throws ExitException { return parseBoolean(properties, param, null); } }
ConfigParser { public static boolean parseBoolean(final Properties properties, final String param) throws ExitException { return parseBoolean(properties, param, null); } private  ConfigParser(); }
ConfigParser { public static boolean parseBoolean(final Properties properties, final String param) throws ExitException { return parseBoolean(properties, param, null); } private  ConfigParser(); static void checkParamExists(final Properties properties, final String param); static boolean parseBoolean(final Properties properties, final String param); static boolean parseBoolean(final Properties properties, final String param, final Boolean defaultValue); static int parseInteger(final Properties properties, final String param); static int parseInteger(final Properties properties, final String param, final Integer defaultValue); static long parseLong(final Properties properties, final String param); static long parseLong(final Properties properties, final String param, final Long defaultValue); static String parseString(final Properties properties, final String param); static String parseString(final Properties properties, final String param, final String defaultValue); static void validateBooleanParam(final String val); static void validateConfig(final Properties config, final String[] requiredStrings,
        final String[] requiredBooleans, final String[] requiredIntegers, final String[] requiredLongs); static void validateIntegerParam(final String val); static void validateLongParam(final String val); }
ConfigParser { public static boolean parseBoolean(final Properties properties, final String param) throws ExitException { return parseBoolean(properties, param, null); } private  ConfigParser(); static void checkParamExists(final Properties properties, final String param); static boolean parseBoolean(final Properties properties, final String param); static boolean parseBoolean(final Properties properties, final String param, final Boolean defaultValue); static int parseInteger(final Properties properties, final String param); static int parseInteger(final Properties properties, final String param, final Integer defaultValue); static long parseLong(final Properties properties, final String param); static long parseLong(final Properties properties, final String param, final Long defaultValue); static String parseString(final Properties properties, final String param); static String parseString(final Properties properties, final String param, final String defaultValue); static void validateBooleanParam(final String val); static void validateConfig(final Properties config, final String[] requiredStrings,
        final String[] requiredBooleans, final String[] requiredIntegers, final String[] requiredLongs); static void validateIntegerParam(final String val); static void validateLongParam(final String val);  }