@Test (expected = ExitException.class) public void testValidateBooleanParam() throws ExitException { try { ConfigParser.validateBooleanParam("true"); ConfigParser.validateBooleanParam("false"); } catch (NullPointerException | ExitException e) { fail("value is valid"); } try { ConfigParser.validateBooleanParam("Not a boolean"); fail("value is invalid"); } catch (final ExitException e) { assertTrue(true); } ConfigParser.validateBooleanParam(null); fail("value is null"); }
public static void validateBooleanParam(final String val) throws ExitException { if (val == null) { throw new ExitException("Null string"); } final String lc = val.toLowerCase(); if (!(lc.equals("true") || lc.equals("false"))) { throw new ExitException("Invalid boolean value: " + val); } }
ConfigParser { public static void validateBooleanParam(final String val) throws ExitException { if (val == null) { throw new ExitException("Null string"); } final String lc = val.toLowerCase(); if (!(lc.equals("true") || lc.equals("false"))) { throw new ExitException("Invalid boolean value: " + val); } } }
ConfigParser { public static void validateBooleanParam(final String val) throws ExitException { if (val == null) { throw new ExitException("Null string"); } final String lc = val.toLowerCase(); if (!(lc.equals("true") || lc.equals("false"))) { throw new ExitException("Invalid boolean value: " + val); } } private  ConfigParser(); }
ConfigParser { public static void validateBooleanParam(final String val) throws ExitException { if (val == null) { throw new ExitException("Null string"); } final String lc = val.toLowerCase(); if (!(lc.equals("true") || lc.equals("false"))) { throw new ExitException("Invalid boolean value: " + val); } } 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 void validateBooleanParam(final String val) throws ExitException { if (val == null) { throw new ExitException("Null string"); } final String lc = val.toLowerCase(); if (!(lc.equals("true") || lc.equals("false"))) { throw new ExitException("Invalid boolean value: " + val); } } 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);  }