@Test public void findConnectionByApiToUser() { insertFacebookConnection(); insertFacebookConnection2(); assertFacebookConnection(connectionRepository.getConnection(TestFacebookApi.class, "9")); assertEquals( "10", connectionRepository .getConnection(TestFacebookApi.class, "10") .getKey() .getProviderUserId()); }
@Test @SuppressWarnings("unchecked") public void findConnectionByKey() { insertFacebookConnection(); assertFacebookConnection( (Connection<TestFacebookApi>) connectionRepository.getConnection(new ConnectionKey("facebook", "9"))); }
@Test(expected = NoSuchConnectionException.class) public void findConnectionByApiToUserNoSuchConnection() { assertFacebookConnection(connectionRepository.getConnection(TestFacebookApi.class, "9")); }
@Test(expected = NoSuchConnectionException.class) public void findConnectionByKeyNoSuchConnection() { connectionRepository.getConnection(new ConnectionKey("facebook", "bogus")); }