@Test public void Tokenアノテーションによって注釈されていない場合トークンが生成されない() throws Exception { TokenManager manager = new TokenManager(); manager.afterPropertiesSet(); TokenHandlerInterceptor tokenHandler = new TokenHandlerInterceptor(); Field managerField = tokenHandler.getClass().getDeclaredField("manager"); managerField.setAccessible(true); managerField.set(tokenHandler, manager); boolean result = tokenHandler.preHandle(request, response, nothing); assertThat(result, is(true)); String token = manager.getToken(request, Controllers.SCOPE_SESSION); assertThat(token, is(nullValue())); }
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (handler instanceof HandlerMethod) { internalPreProcess((HandlerMethod) handler, request); return true; } else { return true; } }
TokenHandlerInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (handler instanceof HandlerMethod) { internalPreProcess((HandlerMethod) handler, request); return true; } else { return true; } } }
TokenHandlerInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (handler instanceof HandlerMethod) { internalPreProcess((HandlerMethod) handler, request); return true; } else { return true; } } TokenHandlerInterceptor(); }
TokenHandlerInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (handler instanceof HandlerMethod) { internalPreProcess((HandlerMethod) handler, request); return true; } else { return true; } } TokenHandlerInterceptor(); @Override boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler); }
TokenHandlerInterceptor extends HandlerInterceptorAdapter { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (handler instanceof HandlerMethod) { internalPreProcess((HandlerMethod) handler, request); return true; } else { return true; } } TokenHandlerInterceptor(); @Override boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler);  }