HttpServletRequestParams { public static int getInt(HttpServletRequest request, String param, int defaultValue) { final String value = request.getParameter(param); int result = defaultValue; if (value != null) { try { result = Integer.parseInt(value); } catch (NumberFormatException e) { LOG.warn("Invalid int 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 testGetIntParam() { EasyMock.replay(request); assertEquals(123, HttpServletRequestParams.getInt(request, INT_PARAM, 456)); assertEquals(456, HttpServletRequestParams.getInt(request, STRING_PARAM, 456)); assertEquals(456, HttpServletRequestParams.getInt(request, UNSET_PARAM, 456)); assertEquals(456, HttpServletRequestParams.getInt(request, LONG_PARAM, 456)); }