ConfigParser { public static void checkParamExists(final Properties properties, final String param) throws ExitException { if (!properties.containsKey(param)) { throw new ExitException("Missing configuration option: " + param); } } 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);  }
@Test(expected = ExitException.class) public void testCheckParamExists() throws ExitException { final Properties properties = new Properties(); final String key = "p1"; properties.put(key, key); try { ConfigParser.checkParamExists(properties, key); } catch (final ExitException e) { fail("Parameter exists"); } properties.remove(key); ConfigParser.checkParamExists(properties, key); }