@@ -399,11 +399,9 @@ public void testLoginWithAsyncWithLinkedLazyUser() throws Exception {
399
399
ParseCorePlugins .getInstance ().registerCurrentUserController (currentUserController );
400
400
401
401
String authType = "facebook" ;
402
- ParseAuthenticationProvider provider = mock (ParseAuthenticationProvider .class );
403
- when (provider .getAuthType ()).thenReturn (authType );
404
402
Map <String , String > authData = new HashMap <>();
405
403
authData .put ("token" , "123" );
406
- ParseUser userAfterLogin = ParseTaskUtils .wait (ParseUser .logInWithAsync (provider , authData ));
404
+ ParseUser userAfterLogin = ParseTaskUtils .wait (ParseUser .logInWithAsync (authType , authData ));
407
405
408
406
// Make sure we stripAnonymity
409
407
assertNull (userAfterLogin .getAuthData ().get (ParseAnonymousUtils .AUTH_TYPE ));
@@ -430,12 +428,10 @@ public void testLoginWithAsyncWithLinkedLazyUseAndResolveLazinessFailure() throw
430
428
ParseCorePlugins .getInstance ().registerCurrentUserController (currentUserController );
431
429
432
430
String authType = "facebook" ;
433
- ParseAuthenticationProvider provider = mock (ParseAuthenticationProvider .class );
434
- when (provider .getAuthType ()).thenReturn (authType );
435
431
Map <String , String > authData = new HashMap <>();
436
432
authData .put ("token" , "123" );
437
433
438
- Task <ParseUser > loginTask = ParseUser .logInWithAsync (provider , authData );
434
+ Task <ParseUser > loginTask = ParseUser .logInWithAsync (authType , authData );
439
435
loginTask .waitForCompletion ();
440
436
441
437
// Make sure we try to resolveLaziness
@@ -460,23 +456,21 @@ public void testLoginWithAsyncWithLinkedNotLazyUser() throws Exception {
460
456
ParseUser partialMockCurrentUser = spy (currentUser ); // ParseUser.mutex
461
457
doReturn (Task .<Void >forResult (null ))
462
458
.when (partialMockCurrentUser )
463
- .linkWithAsync (any ( ParseAuthenticationProvider . class ), Matchers .<Map <String , String >>any ());
459
+ .linkWithAsync (anyString ( ), Matchers .<Map <String , String >>any ());
464
460
ParseCurrentUserController currentUserController = mock (ParseCurrentUserController .class );
465
461
when (currentUserController .getAsync ()).thenReturn (Task .forResult (partialMockCurrentUser ));
466
462
when (currentUserController .getAsync (anyBoolean ()))
467
463
.thenReturn (Task .forResult (partialMockCurrentUser ));
468
464
ParseCorePlugins .getInstance ().registerCurrentUserController (currentUserController );
469
465
470
466
String authType = "facebook" ;
471
- ParseAuthenticationProvider provider = mock (ParseAuthenticationProvider .class );
472
- when (provider .getAuthType ()).thenReturn (authType );
473
467
Map <String , String > authData = new HashMap <>();
474
468
authData .put ("token" , "123" );
475
469
476
- ParseUser userAfterLogin = ParseTaskUtils .wait (ParseUser .logInWithAsync (provider , authData ));
470
+ ParseUser userAfterLogin = ParseTaskUtils .wait (ParseUser .logInWithAsync (authType , authData ));
477
471
478
472
// Make sure we link authData
479
- verify (partialMockCurrentUser , times (1 )).linkWithAsync (provider , authData );
473
+ verify (partialMockCurrentUser , times (1 )).linkWithAsync (authType , authData );
480
474
assertSame (partialMockCurrentUser , userAfterLogin );
481
475
}
482
476
@@ -501,7 +495,7 @@ public void testLoginWithAsyncWithLinkedNotLazyUserLinkFailure() throws Exceptio
501
495
new ParseException (ParseException .ACCOUNT_ALREADY_LINKED , "Account already linked" );
502
496
doReturn (Task .<Void >forError (linkException ))
503
497
.when (partialMockCurrentUser )
504
- .linkWithAsync (any ( ParseAuthenticationProvider . class ), Matchers .<Map <String , String >>any ());
498
+ .linkWithAsync (anyString ( ), Matchers .<Map <String , String >>any ());
505
499
ParseCurrentUserController currentUserController = mock (ParseCurrentUserController .class );
506
500
when (currentUserController .getAsync ()).thenReturn (Task .forResult (partialMockCurrentUser ));
507
501
when (currentUserController .setAsync (any (ParseUser .class )))
@@ -510,14 +504,12 @@ public void testLoginWithAsyncWithLinkedNotLazyUserLinkFailure() throws Exceptio
510
504
511
505
512
506
String authType = "facebook" ;
513
- ParseAuthenticationProvider provider = mock (ParseAuthenticationProvider .class );
514
- when (provider .getAuthType ()).thenReturn (authType );
515
507
Map <String , String > authData = new HashMap <>();
516
508
authData .put ("token" , "123" );
517
- ParseUser userAfterLogin = ParseTaskUtils .wait (ParseUser .logInWithAsync (provider , authData ));
509
+ ParseUser userAfterLogin = ParseTaskUtils .wait (ParseUser .logInWithAsync (authType , authData ));
518
510
519
511
// Make sure we link authData
520
- verify (partialMockCurrentUser , times (1 )).linkWithAsync ( provider , authData );
512
+ verify (partialMockCurrentUser , times (1 )).linkWithAsync (authType , authData );
521
513
// Make sure we login authData
522
514
verify (userController , times (1 )).logInAsync ("facebook" , authData );
523
515
// Make sure we save the new created user as currentUser
@@ -546,12 +538,10 @@ public void testLoginWithAsyncWithNoCurrentUser() throws Exception {
546
538
ParseCorePlugins .getInstance ().registerCurrentUserController (currentUserController );
547
539
548
540
String authType = "facebook" ;
549
- ParseAuthenticationProvider provider = mock (ParseAuthenticationProvider .class );
550
- when (provider .getAuthType ()).thenReturn (authType );
551
541
Map <String , String > authData = new HashMap <>();
552
542
authData .put ("token" , "123" );
553
543
554
- ParseUser userAfterLogin = ParseTaskUtils .wait (ParseUser .logInWithAsync (provider , authData ));
544
+ ParseUser userAfterLogin = ParseTaskUtils .wait (ParseUser .logInWithAsync (authType , authData ));
555
545
556
546
// Make sure we login authData
557
547
verify (userController , times (1 )).logInAsync ("facebook" , authData );
@@ -596,7 +586,7 @@ public void testLinkWithAsyncWithSaveAsyncSuccess() throws Exception {
596
586
Map <String , String > authData = new HashMap <>();
597
587
authData .put ("token" , "test" );
598
588
599
- ParseTaskUtils .wait (partialMockUser .linkWithAsync (provider , authData ));
589
+ ParseTaskUtils .wait (partialMockUser .linkWithAsync (provider . getAuthType () , authData ));
600
590
601
591
// Make sure we stripAnonymity
602
592
assertNull (partialMockUser .getAuthData ().get (ParseAnonymousUtils .AUTH_TYPE ));
@@ -632,13 +622,11 @@ public void testLinkWithAsyncWithSaveAsyncFailure() throws Exception {
632
622
.when (partialMockUser )
633
623
.getSessionToken ();
634
624
String authType = "facebook" ;
635
- ParseAuthenticationProvider provider = mock (ParseAuthenticationProvider .class );
636
- when (provider .getAuthType ()).thenReturn (authType );
637
625
Map <String , String > authData = new HashMap <>();
638
626
authData .put ("facebookToken" , "facebookTest" );
639
627
640
628
Task <Void > linkTask =
641
- partialMockUser .linkWithAsync (provider , authData );
629
+ partialMockUser .linkWithAsync (authType , authData );
642
630
linkTask .waitForCompletion ();
643
631
644
632
// Make sure new authData is added
0 commit comments