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");
expectedError.put("errorDescription", "The user said no.");
expectedError.put("errorUri", "http://provider.com/user/said/no");
mockMvc.perform(get("/connect/oauth2Provider").param("error", "access_denied")