ConfigParser { public static void validateLongParam(final String val) throws ExitException { if (val == null) { throw new NullPointerException(); } try { Long.parseLong(val); } catch (final NumberFormatException e) { throw new ExitException("Invalid long: " + val, e); } } 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 public void testValidateLongParam() { try { ConfigParser.validateLongParam(Long.toString(Long.MAX_VALUE)); ConfigParser.validateLongParam(Long.toString(Long.MIN_VALUE)); ConfigParser.validateLongParam(Long.toString(0)); } catch (NullPointerException | ExitException e) { fail("value is valid"); } try { ConfigParser.validateLongParam("0.0"); fail("value is invalid"); } catch (final ExitException e) { ; } try { ConfigParser.validateLongParam(null); fail("value is null"); } catch (final ExitException e) { fail("value is null"); } catch (final NullPointerException e) { ; } }