private FilterTestEnv(String method, String requestURI, String signupUrl) {
      context = new MockServletContext();
      req = new MockHttpServletRequest(context, method, requestURI);
      res = new MockHttpServletResponse();
      chain = new MockFilterChain();
      authManager = mock(AuthenticationManager.class);
      userIdSource = mock(UserIdSource.class);
      usersConnectionRepository = mock(UsersConnectionRepository.class);
      connectionRepository = mock(ConnectionRepository.class);

      filter =
          new SocialAuthenticationFilter(
              authManager,
              userIdSource,
              usersConnectionRepository,
              new SocialAuthenticationServiceRegistry());
      filter.setServletContext(context);
      filter.setRememberMeServices(new NullRememberMeServices());
      filter.setSignupUrl(signupUrl);

      when(filter.getUsersConnectionRepository().createConnectionRepository(Mockito.anyString()))
          .thenReturn(connectionRepository);

      auth = new SocialAuthenticationToken(DummyConnection.dummy("provider", "user"), null);

      Collection<? extends GrantedAuthority> authorities = Collections.emptyList();
      User user = new SocialUser("foo", "bar", authorities);
      authSuccess =
          new SocialAuthenticationToken(
              DummyConnection.dummy("provider", "user"), user, null, authorities);
    }