### Question:
DeviceResolverHandlerInterceptor extends HandlerInterceptorAdapter { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Device device = deviceResolver.resolveDevice(request); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); return true; } DeviceResolverHandlerInterceptor();  DeviceResolverHandlerInterceptor(DeviceResolver deviceResolver); boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler);  }### Answer:
@Test public void resolve() throws Exception { assertTrue(interceptor.preHandle(request, response, null)); assertSame(device, DeviceUtils.getCurrentDevice(request)); }
@Test public void resolveDefaultResolver() throws Exception { interceptor = new DeviceResolverHandlerInterceptor(); request.addHeader("User-Agent", "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7"); assertTrue(interceptor.preHandle(request, response, null)); Device device = DeviceUtils.getCurrentDevice(request); assertTrue(device.isMobile()); }