### Question:
CurrentUserHandlerMethodArgumentResolver implements
		HandlerMethodArgumentResolver { public Object resolveArgument(MethodParameter methodParameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception { if (this.supportsParameter(methodParameter)) { Principal principal = (Principal) webRequest.getUserPrincipal(); return (User) ((Authentication) principal).getPrincipal(); } else { return WebArgumentResolver.UNRESOLVED; } }  boolean supportsParameter(MethodParameter methodParameter); Object resolveArgument(MethodParameter methodParameter,
			ModelAndViewContainer mavContainer, NativeWebRequest webRequest,
			WebDataBinderFactory binderFactory);  }### Answer:
@Test public void testResolveArgument() throws Exception { ModelAndViewContainer mavContainer = mock(ModelAndViewContainer.class); WebDataBinderFactory binderFactory = mock(WebDataBinderFactory.class); NativeWebRequest webRequest = mock(NativeWebRequest.class); User stubUser = new User(USER_NAME, "", Collections.emptyList()); Principal stubPrincipal = new UsernamePasswordAuthenticationToken(stubUser, null); when(webRequest.getUserPrincipal()).thenReturn(stubPrincipal); assertEquals(stubUser, resolver.resolveArgument(validParam, mavContainer, webRequest,binderFactory)); assertEquals(WebArgumentResolver.UNRESOLVED, resolver.resolveArgument(notAnnotatedParam, mavContainer, webRequest,binderFactory)); assertEquals(WebArgumentResolver.UNRESOLVED, resolver.resolveArgument(wrongTypeParam, mavContainer, webRequest,binderFactory)); }