HttpServletRequestParams { public static long getLong(HttpServletRequest request, String param, long defaultValue) { final String value = request.getParameter(param); long result = defaultValue; if (value != null) { try { result = Long.parseLong(value); } catch (NumberFormatException e) { LOG.warn("Invalid long for " + param + ": " + value); } } return result; }  static int getInt(HttpServletRequest request, String param, int defaultValue); static long getLong(HttpServletRequest request, String param, long defaultValue); static boolean getBool(HttpServletRequest request, String param, boolean defaultValue); @Nullable static String getString(HttpServletRequest request, String param,
                                 @Nullable String defaultValue);  }
@Test public void testGetLongParam() { EasyMock.replay(request); assertEquals(123, HttpServletRequestParams.getLong(request, INT_PARAM, 456)); assertEquals(260833376896966656L, HttpServletRequestParams.getLong(request, LONG_PARAM, 456)); assertEquals(123456789012345678L, HttpServletRequestParams.getLong(request, STRING_PARAM, 123456789012345678L)); assertEquals(456, HttpServletRequestParams.getLong(request, UNSET_PARAM, 456)); }