### Question:
DeviceWebArgumentResolver implements WebArgumentResolver { public Object resolveArgument(MethodParameter param, NativeWebRequest request) throws Exception { if (Device.class.isAssignableFrom(param.getParameterType())) { return DeviceUtils.getCurrentDevice(request); } else { return WebArgumentResolver.UNRESOLVED; } }  Object resolveArgument(MethodParameter param, NativeWebRequest request);  }### Answer:
@Test public void resolve() throws Exception { request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device, WebRequest.SCOPE_REQUEST); MethodParameter parameter = new MethodParameter(getClass().getMethod("handlerMethod", Device.class), 0); Object resolved = resolver.resolveArgument(parameter, request); assertSame(device, resolved); }
@Test public void unresolved() throws Exception { request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device, WebRequest.SCOPE_REQUEST); MethodParameter parameter = new MethodParameter(getClass().getMethod("handlerMethodUnresolved", String.class), 0); Object resolved = resolver.resolveArgument(parameter, request); assertSame(WebArgumentResolver.UNRESOLVED, resolved); }