use of com.parse.ParseUser in project Parse-SDK-Android by ParsePlatform.
the class ParseTwitterUtilsTest method testLinkWithContext.
@Test
@SuppressWarnings("unchecked")
public void testLinkWithContext() {
ParseTwitterUtils.isInitialized = true;
Map<String, String> authData = new HashMap<>();
when(controller.authenticateAsync(any(Context.class))).thenReturn(Task.forResult(authData));
Context context = mock(Context.class);
ParseUser user = mock(ParseUser.class);
when(user.linkWithInBackground(anyString(), any())).thenReturn(Task.forResult(null));
Task<Void> task = ParseTwitterUtils.linkInBackground(context, user);
verify(controller).authenticateAsync(context);
verify(user).linkWithInBackground("twitter", authData);
assertTrue(task.isCompleted());
}
use of com.parse.ParseUser in project Parse-SDK-Android by ParsePlatform.
the class ParseTwitterUtilsTest method testUnlink.
// endregion
@Test
public void testUnlink() {
ParseTwitterUtils.isInitialized = true;
ParseUser user = mock(ParseUser.class);
when(user.unlinkFromInBackground(anyString())).thenReturn(Task.forResult(null));
Task<Void> task = ParseTwitterUtils.unlinkInBackground(user);
verify(user).unlinkFromInBackground("twitter");
verifyNoMoreInteractions(user);
assertTrue(task.isCompleted());
}
Aggregations