private void assertNewConnection(Connection<TestFacebookApi> connection) { assertEquals("facebook", connection.getKey().getProviderId()); assertEquals("9", connection.getKey().getProviderUserId()); assertEquals("Keith Donald", connection.getDisplayName()); assertEquals("http://facebook.com/keith.donald", connection.getProfileUrl()); assertEquals("http://facebook.com/keith.donald/picture", connection.getImageUrl()); assertTrue(connection.test()); TestFacebookApi api = connection.getApi(); assertNotNull(api); assertEquals("123456789", api.getAccessToken()); assertEquals("123456789", connection.createData().getAccessToken()); assertEquals("987654321", connection.createData().getRefreshToken()); }
private void assertTwitterConnection(Connection<TestTwitterApi> twitter) { assertEquals(new ConnectionKey("twitter", "1"), twitter.getKey()); assertEquals("@kdonald", twitter.getDisplayName()); assertEquals("http://twitter.com/kdonald", twitter.getProfileUrl()); assertEquals("http://twitter.com/kdonald/picture", twitter.getImageUrl()); TestTwitterApi twitterApi = twitter.getApi(); assertEquals("123456789", twitterApi.getAccessToken()); assertEquals("987654321", twitterApi.getSecret()); twitter.sync(); assertEquals("http://twitter.com/kdonald/a_new_picture", twitter.getImageUrl()); }
private void assertFacebookConnection(Connection<TestFacebookApi> facebook) { assertEquals(new ConnectionKey("facebook", "9"), facebook.getKey()); assertEquals(null, facebook.getDisplayName()); assertEquals(null, facebook.getProfileUrl()); assertEquals(null, facebook.getImageUrl()); TestFacebookApi facebookApi = facebook.getApi(); assertEquals("234567890", facebookApi.getAccessToken()); facebook.sync(); assertEquals("Keith Donald", facebook.getDisplayName()); assertEquals("http://facebook.com/keith.donald", facebook.getProfileUrl()); assertEquals("http://facebook.com/keith.donald/picture", facebook.getImageUrl()); }