CookieInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { validateSessionId((HttpServletRequest) request, (HttpServletResponse) response); return super.preHandle(request, response, handler); }  @Override boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler); static boolean isSpider(HttpServletRequest request);  }
@Test public void preHandle() { try { when(request.getHeader(NetUtil.USER_AGENT)).thenReturn("windows"); new CookieInterceptor().preHandle(request, mock(HttpServletResponse.class), mock(Object.class)); } catch (Exception e) { fail("" + e); } }