### Question:
ProviderSignInController implements InitializingBean { @RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="error") public RedirectView oauth2ErrorCallback(@PathVariable String providerId, @RequestParam("error") String error, @RequestParam(value="error_description", required=false) String errorDescription, @RequestParam(value="error_uri", required=false) String errorUri, NativeWebRequest request) { logger.warn("Error during authorization: " + error); URIBuilder uriBuilder = URIBuilder.fromUri(signInUrl).queryParam("error", error); if (errorDescription != null ) { uriBuilder.queryParam("error_description", errorDescription); } if (errorUri != null ) { uriBuilder.queryParam("error_uri", errorUri); } return redirect(uriBuilder.build().toString()); } @Inject  ProviderSignInController(ConnectionFactoryLocator connectionFactoryLocator, UsersConnectionRepository usersConnectionRepository, SignInAdapter signInAdapter); void setSignInInterceptors(List<ProviderSignInInterceptor<?>> interceptors); void setSignInUrl(String signInUrl); void setSignUpUrl(String signUpUrl); void setPostSignInUrl(String postSignInUrl); void setApplicationUrl(String applicationUrl); void setSessionStrategy(SessionStrategy sessionStrategy); void addSignInInterceptor(ProviderSignInInterceptor<?> interceptor); @RequestMapping(value="/{providerId}", method=RequestMethod.POST) RedirectView signIn(@PathVariable String providerId, NativeWebRequest request); @RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="oauth_token") RedirectView oauth1Callback(@PathVariable String providerId, NativeWebRequest request); @RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="code") RedirectView oauth2Callback(@PathVariable String providerId, @RequestParam("code") String code, NativeWebRequest request); @RequestMapping(value="/{providerId}", method=RequestMethod.GET, params="error") RedirectView oauth2ErrorCallback(@PathVariable String providerId,
			@RequestParam("error") String error,
			@RequestParam(value="error_description", required=false) String errorDescription,
			@RequestParam(value="error_uri", required=false) String errorUri,
			NativeWebRequest request); @RequestMapping(value="/{providerId}", method=RequestMethod.GET) RedirectView canceledAuthorizationCallback(); void afterPropertiesSet();  }### Answer:
@Test public void oauth2ErrorCallback() throws Exception { ConnectionFactoryRegistry connectionFactoryLocator = new ConnectionFactoryRegistry(); ConnectionFactory<TestApi2> connectionFactory2 = new StubOAuth2ConnectionFactory("clientId", "clientSecret"); connectionFactoryLocator.addConnectionFactory(connectionFactory2); StubUsersConnectionRepository usersConnectionRepository = new StubUsersConnectionRepository(); ProviderSignInController controller = new ProviderSignInController(connectionFactoryLocator, usersConnectionRepository, null); MockMvc mockMvc = standaloneSetup(controller).build(); mockMvc.perform(get("/signin/oauth2Provider").param("error", "access_denied")) .andExpect(redirectedUrl("/signin?error=access_denied")); }