Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Robolectric to 4.9 #4161

Merged
merged 2 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;

/** Tests for {@link DebugAppCheckProvider}. */
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
@LooperMode(LooperMode.Mode.LEGACY)
public class DebugAppCheckProviderTest {

private static final String DEBUG_SECRET = "debugSecret";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;

/** Tests for {@link PlayIntegrityAppCheckProvider}. */
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
@LooperMode(LooperMode.Mode.LEGACY)
public class PlayIntegrityAppCheckProviderTest {

private static final String PROJECT_NUMBER = "123456";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;

/** Tests for {@link SafetyNetAppCheckProvider}. */
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
@LooperMode(LooperMode.Mode.LEGACY)
public class SafetyNetAppCheckProviderTest {

private static final String API_KEY = "apiKey";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;

/** Tests for {@link DefaultFirebaseAppCheck}. */
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
@LooperMode(LooperMode.Mode.LEGACY)
public class DefaultFirebaseAppCheckTest {

private static final String EXCEPTION_TEXT = "exceptionText";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.LooperMode;

@RunWith(RobolectricTestRunner.class)
@LooperMode(LooperMode.Mode.LEGACY)
public class DefaultTokenRefresherTest {

private static final long TIME_TO_REFRESH_MILLIS = 1000L;
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ext {
supportAnnotationsVersion = '28.0.0'
googleTruthVersion = '1.1.2'
grpcVersion = '1.48.1'
robolectricVersion = '4.3.1'
robolectricVersion = '4.9'
protocVersion = '3.17.3'
javaliteVersion = '3.17.3'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.LooperMode;

@RunWith(RobolectricTestRunner.class)
@LooperMode(LooperMode.Mode.LEGACY)
public class FirebaseAppDistributionProxyTest {

private FirebaseAppDistribution firebaseAppDistribution;
Expand Down
2 changes: 1 addition & 1 deletion firebase-appdistribution/firebase-appdistribution.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies {
runtimeOnly project(':firebase-installations')

testImplementation 'junit:junit:4.13.2'
testImplementation "org.robolectric:robolectric:4.8.1"
testImplementation "org.robolectric:robolectric:$robolectricVersion"
testImplementation "com.google.truth:truth:$googleTruthVersion"
testImplementation 'org.mockito:mockito-inline:3.4.0'
androidTestImplementation "org.mockito:mockito-android:3.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;

@RunWith(AndroidJUnit4.class)
@Config(sdk = 25)
@LooperMode(LooperMode.Mode.LEGACY)
public class DataCollectionPostNDefaultDisabledTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;

@RunWith(AndroidJUnit4.class)
@Config(sdk = 19)
Expand Down Expand Up @@ -81,6 +82,7 @@ public void setDataCollectionDefaultEnabledTrue_shouldUpdateSharedPrefs() {
}

@Test
@LooperMode(LooperMode.Mode.LEGACY)
public void setDataCollectionDefaultEnabledTrue_shouldEmitEvents() {
withApp(
app -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;
import org.skyscreamer.jsonassert.JSONAssert;

/**
Expand All @@ -93,6 +94,7 @@
@Config(
manifest = Config.NONE,
shadows = {ShadowPreconditions.class})
@LooperMode(LooperMode.Mode.LEGACY)
public final class FirebaseRemoteConfigTest {
private static final String APP_ID = "1:14368190084:android:09cb977358c6f241";
private static final String API_KEY = "AIzaSyabcdefghijklmnopqrstuvwxyz1234567";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;

/**
* Unit tests for the Firebase Remote Config Component.
Expand Down Expand Up @@ -92,6 +93,7 @@ public void setUp() {
}

@Test
@LooperMode(LooperMode.Mode.LEGACY)
public void frc2p_doesNotCallAbt() throws Exception {

FirebaseRemoteConfig fireperfFrc =
Expand All @@ -106,6 +108,7 @@ public void frc2p_doesNotCallAbt() throws Exception {
}

@Test
@LooperMode(LooperMode.Mode.LEGACY)
public void frcNonMainFirebaseApp_doesNotCallAbt() throws Exception {

when(mockFirebaseApp.getName()).thenReturn("secondary");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;
import org.skyscreamer.jsonassert.JSONAssert;

/**
Expand All @@ -99,6 +100,7 @@
*/
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
@LooperMode(LooperMode.Mode.LEGACY)
public class ConfigFetchHandlerTest {
private static final String INSTALLATION_ID = "'fL71_VyL3uo9jNMWu1L60S";
private static final String INSTALLATION_AUTH_TOKEN =
Expand Down
2 changes: 1 addition & 1 deletion firebase-crashlytics/firebase-crashlytics.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ dependencies {

testImplementation 'androidx.test:runner:1.4.0'
testImplementation 'androidx.test:core:1.4.0'
testImplementation "org.robolectric:robolectric:4.5"
testImplementation "org.robolectric:robolectric:$robolectricVersion"
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:3.4.3'

Expand Down
1 change: 1 addition & 0 deletions firebase-database/firebase-database.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ dependencies {

testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.25.0'
testImplementation 'org.codehaus.plexus:plexus-utils:3.4.2'
utzcoz marked this conversation as resolved.
Show resolved Hide resolved
testImplementation "org.robolectric:robolectric:$robolectricVersion"
testImplementation 'com.firebase:firebase-token-generator:2.0.0'
testImplementation 'com.fasterxml.jackson.core:jackson-core:2.9.8'
Expand Down
4 changes: 1 addition & 3 deletions firebase-firestore/firebase-firestore.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ dependencies {
testImplementation 'androidx.test:core:1.2.0'
testImplementation "org.hamcrest:hamcrest-junit:2.0.0.0"
testImplementation 'org.mockito:mockito-core:2.25.0'
testImplementation ("org.robolectric:robolectric:4.8.2") {
exclude group: 'com.google.protobuf', module: 'protobuf-java'
}
testImplementation "org.robolectric:robolectric:$robolectricVersion"
testImplementation "com.google.truth:truth:$googleTruthVersion"
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
testImplementation 'com.google.guava:guava-testlib:12.0-rc2'
Expand Down
1 change: 1 addition & 0 deletions firebase-firestore/ktx/ktx.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ dependencies {
implementation 'androidx.annotation:annotation:1.1.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
implementation 'com.google.android.gms:play-services-basement:18.1.0'
testCompileOnly "com.google.protobuf:protobuf-java:$protocVersion"
testImplementation project(':firebase-database-collection')
testImplementation 'org.mockito:mockito-core:2.25.0'
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;
import org.robolectric.shadows.ShadowActivity;
import org.robolectric.shadows.ShadowPackageManager;

@RunWith(RobolectricTestRunner.class)
@Config(sdk = 21, qualifiers = "port")
@LooperMode(LooperMode.Mode.LEGACY)
public class FirebaseInAppMessagingDisplayTest {

private com.google.firebase.inappmessaging.display.FirebaseInAppMessagingDisplay fiamUI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;

// TODO: Refactor and clean this logic
@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
@LooperMode(LooperMode.Mode.LEGACY)
public class InAppMessageStreamManagerTest {
private static final long PAST = 1000000;
private static final long NOW = PAST + 100000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.annotation.LooperMode;

@RunWith(RobolectricTestRunner.class)
@Config(manifest = Config.NONE)
@LooperMode(LooperMode.Mode.LEGACY)
public class MetricsLoggerClientTest {
private static final long PAST = 1000000;
private static final long NOW = PAST + 100000;
Expand Down
Loading