Skip to content

Commit 9fe6660

Browse files
committed
Merge branch 'feat/P2' of github.com:demolaf/FirebaseUI-Android into feat/S3
2 parents ca4a5fb + 16c6126 commit 9fe6660

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

auth/src/main/java/com/firebase/ui/auth/compose/configuration/auth_provider/EmailAuthProvider+FirebaseAuthUI.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ internal suspend fun FirebaseAuthUI.createOrLinkUserWithEmailAndPassword(
166166
if (canUpgrade && pendingCredential != null) {
167167
// Anonymous upgrade collision: emit merge conflict state
168168
updateAuthState(AuthState.MergeConflict(pendingCredential))
169+
} else {
170+
updateAuthState(AuthState.Error(authException))
169171
}
170172
throw authException
171173
} catch (e: CancellationException) {
@@ -465,6 +467,8 @@ internal suspend fun FirebaseAuthUI.signInAndLinkWithCredential(
465467
} else {
466468
updateAuthState(AuthState.Error(authException))
467469
}
470+
} else {
471+
updateAuthState(AuthState.Error(authException))
468472
}
469473
throw authException
470474
} catch (e: CancellationException) {

auth/src/test/java/com/firebase/ui/auth/testhelpers/TestHelper.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,19 @@ public static void initialize() {
7676
}
7777

7878
private static void spyContextAndResources() {
79-
// In Mockito 5.x, we need to avoid spying on objects that are already mocks/spies
79+
// In Mockito 5.x with inline mock maker, we can spy on final classes
80+
// Use doReturn().when() pattern to avoid calling real methods during stubbing
8081
if (!org.mockito.Mockito.mockingDetails(CONTEXT).isSpy()) {
8182
CONTEXT = spy(CONTEXT);
8283
}
8384
doReturn(CONTEXT).when(CONTEXT).getApplicationContext();
8485

85-
Resources resources = CONTEXT.getResources();
86-
if (!org.mockito.Mockito.mockingDetails(resources).isSpy()) {
87-
resources = spy(resources);
86+
// Get and spy on Resources, ensuring the spy is properly returned
87+
Resources originalResources = CONTEXT.getResources();
88+
if (!org.mockito.Mockito.mockingDetails(originalResources).isSpy()) {
89+
Resources spiedResources = spy(originalResources);
90+
doReturn(spiedResources).when(CONTEXT).getResources();
8891
}
89-
doReturn(resources).when(CONTEXT).getResources();
9092
}
9193

9294
private static void initializeApp(Context context) {

0 commit comments

Comments
 (0)