@Test(expected = DataIntegrityViolationException.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 findUserIdWithConnectionNoSuchConnection() { Connection<TestFacebookApi> connection = connectionFactory.createConnection(new AccessGrant("12345")); assertEquals(0, usersConnectionRepository.findUserIdsWithConnection(connection).size()); }