@@ -221,7 +221,7 @@ public void testSignUpAsyncWithMergeInDiskAnonymousUser() throws Exception {
221
221
when (currentUser .isLinked (ParseAnonymousUtils .AUTH_TYPE )).thenReturn (true );
222
222
when (currentUser .getSessionToken ()).thenReturn ("oldSessionToken" );
223
223
when (currentUser .getAuthData ()).thenReturn (new HashMap <String , Map <String , String >>());
224
- when (currentUser .saveAsync (anyString (), Matchers .<Task <Void >>any ()))
224
+ when (currentUser .saveAsync (anyString (), eq ( false ), Matchers .<Task <Void >>any ()))
225
225
.thenReturn (Task .<Void >forResult (null ));
226
226
ParseUser .State state = new ParseUser .State .Builder ()
227
227
.put ("oldKey" , "oldValue" )
@@ -249,7 +249,8 @@ public void testSignUpAsyncWithMergeInDiskAnonymousUser() throws Exception {
249
249
verify (currentUser , times (1 )).setUsername ("userName" );
250
250
verify (currentUser , times (1 )).setPassword ("password" );
251
251
// Make sure we save currentUser
252
- verify (currentUser , times (1 )).saveAsync (eq ("oldSessionToken" ), Matchers .<Task <Void >>any ());
252
+ verify (currentUser , times (1 ))
253
+ .saveAsync (eq ("oldSessionToken" ), eq (false ), Matchers .<Task <Void >>any ());
253
254
// Make sure we merge currentUser with user after save
254
255
assertEquals ("oldValue" , user .get ("oldKey" ));
255
256
// Make sure set currentUser
@@ -264,13 +265,14 @@ public void testSignUpAsyncWithMergeInDiskAnonymousUserSaveFailure() throws Exce
264
265
oldAnonymousAuthData .put ("oldKey" , "oldToken" );
265
266
currentUser .putAuthData (ParseAnonymousUtils .AUTH_TYPE , oldAnonymousAuthData );
266
267
ParseUser partialMockCurrentUser = spy (currentUser );
268
+ when (partialMockCurrentUser .getObjectId ()).thenReturn ("oldObjectId" );
267
269
when (partialMockCurrentUser .getUsername ()).thenReturn ("oldUserName" );
268
270
when (partialMockCurrentUser .getPassword ()).thenReturn ("oldPassword" );
269
271
when (partialMockCurrentUser .getSessionToken ()).thenReturn ("oldSessionToken" );
270
272
ParseException saveException = new ParseException (ParseException .OTHER_CAUSE , "" );
271
273
doReturn (Task .<Void >forError (saveException ))
272
274
.when (partialMockCurrentUser )
273
- .saveAsync (anyString (), Matchers .<Task <Void >>any ());
275
+ .saveAsync (anyString (), eq ( false ), Matchers .<Task <Void >>any ());
274
276
ParseCurrentUserController currentUserController = mock (ParseCurrentUserController .class );
275
277
when (currentUserController .getAsync (anyBoolean ()))
276
278
.thenReturn (Task .forResult (partialMockCurrentUser ));
@@ -295,7 +297,7 @@ public void testSignUpAsyncWithMergeInDiskAnonymousUserSaveFailure() throws Exce
295
297
verify (partialMockCurrentUser , times (1 )).copyChangesFrom (eq (user ));
296
298
// Make sure we save currentUser
297
299
verify (partialMockCurrentUser , times (1 ))
298
- .saveAsync (eq ("oldSessionToken" ), Matchers .<Task <Void >>any ());
300
+ .saveAsync (eq ("oldSessionToken" ), eq ( false ), Matchers .<Task <Void >>any ());
299
301
// Make sure we restore old username and password after save fails
300
302
verify (partialMockCurrentUser , times (1 )).setUsername ("oldUserName" );
301
303
verify (partialMockCurrentUser , times (1 )).setPassword ("oldPassword" );
@@ -575,7 +577,7 @@ public void testLinkWithAsyncWithSaveAsyncSuccess() throws Exception {
575
577
ParseUser partialMockUser = spy (user );
576
578
doReturn (Task .<Void >forResult (null ))
577
579
.when (partialMockUser )
578
- .saveAsync (anyString (), Matchers .<Task <Void >>any ());
580
+ .saveAsync (anyString (), eq ( false ), Matchers .<Task <Void >>any ());
579
581
String authType = "facebook" ;
580
582
Map <String , String > authData = new HashMap <>();
581
583
authData .put ("token" , "test" );
@@ -587,7 +589,8 @@ public void testLinkWithAsyncWithSaveAsyncSuccess() throws Exception {
587
589
// Make sure new authData is added
588
590
assertSame (authData , partialMockUser .getAuthData ().get ("facebook" ));
589
591
// Make sure we save the user
590
- verify (partialMockUser , times (1 )).saveAsync (eq ("sessionTokenAgain" ), Matchers .<Task <Void >>any ());
592
+ verify (partialMockUser , times (1 ))
593
+ .saveAsync (eq ("sessionTokenAgain" ), eq (false ), Matchers .<Task <Void >>any ());
591
594
// Make sure synchronizeAuthData() is called
592
595
verify (provider , times (1 )).restoreAuthentication (authData );
593
596
}
@@ -610,7 +613,7 @@ public void testLinkWithAsyncWithSaveAsyncFailure() throws Exception {
610
613
Exception saveException = new Exception ();
611
614
doReturn (Task .<Void >forError (saveException ))
612
615
.when (partialMockUser )
613
- .saveAsync (anyString (), Matchers .<Task <Void >>any ());
616
+ .saveAsync (anyString (), eq ( false ), Matchers .<Task <Void >>any ());
614
617
String facebookAuthType = "facebook" ;
615
618
Map <String , String > facebookAuthData = new HashMap <>();
616
619
facebookAuthData .put ("facebookToken" , "facebookTest" );
@@ -622,7 +625,8 @@ public void testLinkWithAsyncWithSaveAsyncFailure() throws Exception {
622
625
// Make sure new authData is added
623
626
assertSame (facebookAuthData , partialMockUser .getAuthData ().get ("facebook" ));
624
627
// Make sure we save the user
625
- verify (partialMockUser , times (1 )).saveAsync (eq ("sessionTokenAgain" ), Matchers .<Task <Void >>any ());
628
+ verify (partialMockUser , times (1 ))
629
+ .saveAsync (eq ("sessionTokenAgain" ), eq (false ), Matchers .<Task <Void >>any ());
626
630
// Make sure old authData is restored
627
631
assertSame (anonymousAuthData , partialMockUser .getAuthData ().get (ParseAnonymousUtils .AUTH_TYPE ));
628
632
// Verify exception
0 commit comments