Skip to content

Commit 0b7c7a2

Browse files
committed
Replaced FirebaseInstanceId shadow
* FirebaseInstanceId no longer exists in the latest Firebase versions, shadowing FirebaseApp as a replacement. * We are shadowing initializeApp isntead of getToken as initializeApp in the latest firebase version causing an expection to be thrown on a background thread which fails the tests.
1 parent c6cf18c commit 0b7c7a2

File tree

2 files changed

+20
-46
lines changed

2 files changed

+20
-46
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.onesignal;
2+
3+
import android.content.Context;
4+
5+
import androidx.annotation.NonNull;
6+
7+
import com.google.firebase.FirebaseApp;
8+
import com.google.firebase.FirebaseOptions;
9+
10+
import org.robolectric.annotation.Implements;
11+
12+
@Implements(com.google.firebase.FirebaseApp.class)
13+
public class ShadowFirebaseApp {
14+
15+
@NonNull
16+
public static FirebaseApp initializeApp(@NonNull Context context, @NonNull FirebaseOptions options, @NonNull String name) {
17+
// Throw simulates Firebase library not bundled with app
18+
throw new RuntimeException();
19+
}
20+
}

OneSignalSDK/unittest/src/test/java/com/onesignal/ShadowFirebaseCloudMessaging.java

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)