public void oauth2ErrorCallback_noDescriptionOrUri() throws Exception {
ConnectionFactoryRegistry connectionFactoryLocator = new ConnectionFactoryRegistry();
ConnectionFactory<TestApi2> connectionFactory = new StubOAuth2ConnectionFactory("clientId", "clientSecret", THROW_EXCEPTION);
connectionFactoryLocator.addConnectionFactory(connectionFactory);
StubConnectionRepository connectionRepository = new StubConnectionRepository();
MockMvc mockMvc = standaloneSetup(new ConnectController(connectionFactoryLocator, connectionRepository)).build();
assertEquals(0, connectionRepository.findConnections("oauth2Provider").size());
HashMap<String, String> expectedError = new HashMap<String, String>();
expectedError.put("error", "access_denied");
mockMvc.perform(get("/connect/oauth2Provider").param("error", "access_denied"))
.andExpect(redirectedUrl("/connect/oauth2Provider"))
.andExpect(request().sessionAttribute("social_authorization_error", notNullValue()))
.andExpect(request().sessionAttribute("social_authorization_error", expectedError));
}