@Test(expected = DuplicateConnectionException.class)
 public void addConnectionDuplicate() {
   Connection<TestFacebookApi> connection =
       connectionFactory.createConnection(new AccessGrant("123456789", null, "987654321", 3600L));
   connectionRepository.addConnection(connection);
   connectionRepository.addConnection(connection);
 }
 @Test
 public void addConnection() {
   Connection<TestFacebookApi> connection =
       connectionFactory.createConnection(new AccessGrant("123456789", null, "987654321", 3600L));
   connectionRepository.addConnection(connection);
   Connection<TestFacebookApi> restoredConnection =
       connectionRepository.getPrimaryConnection(TestFacebookApi.class);
   assertEquals(connection, restoredConnection);
   assertNewConnection(restoredConnection);
 }
 @Test
 public void findUserIdWithConnectionNoConnection_withConnectionSignUpReturningNull() {
   Connection<TestFacebookApi> connection =
       connectionFactory.createConnection(new AccessGrant("12345"));
   usersConnectionRepository.setConnectionSignUp(
       new ConnectionSignUp() {
         public String execute(Connection<?> connection) {
           return null;
         }
       });
   List<String> userIds = usersConnectionRepository.findUserIdsWithConnection(connection);
   assertEquals(0, userIds.size());
 }
 @Test
 public void findUserIdWithConnectionNoSuchConnection() {
   Connection<TestFacebookApi> connection =
       connectionFactory.createConnection(new AccessGrant("12345"));
   assertEquals(0, usersConnectionRepository.findUserIdsWithConnection(connection).size());
 }