Use non-deprecated replacements for Android JUnit and test instrumentation (flutter/engine#51854)
Just removing some of the noise of walking through Java files in Android Studio, should be a NO-OP[^1]. - `androidx.test.runner.AndroidJUnit4` -> `androidx.test.ext.junit.runners.AndroidJUnit4` - `androidx.test.InstrumentationRegistry` -> `androidx.test.platform.app.InstrumentationRegistry` [^1]: Famous last words.
This commit is contained in:
@@ -7,8 +7,8 @@ package dev.flutter.scenarios;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
|
||||
assertEquals("dev.flutter.scenarios", appContext.getPackageName());
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ package dev.flutter.scenariosui;
|
||||
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import dev.flutter.scenarios.PlatformViewsActivity;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -9,9 +9,9 @@ import static org.junit.Assert.*;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import dev.flutter.scenarios.GetBitmapActivity;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -6,9 +6,9 @@ package dev.flutter.scenariosui;
|
||||
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import dev.flutter.scenarios.PlatformViewsActivity;
|
||||
import leakcanary.FailTestOnLeak;
|
||||
import org.junit.Rule;
|
||||
|
||||
@@ -8,10 +8,10 @@ import android.app.Instrumentation;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import dev.flutter.scenarios.PlatformViewsActivity;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
@@ -8,10 +8,10 @@ import android.app.Instrumentation;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import dev.flutter.scenarios.PlatformViewsActivity;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
@@ -6,9 +6,9 @@ package dev.flutter.scenariosui;
|
||||
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import dev.flutter.scenarios.PlatformViewsActivity;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
@@ -6,9 +6,9 @@ package dev.flutter.scenariosui;
|
||||
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import dev.flutter.scenarios.PlatformViewsActivity;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
@@ -6,9 +6,9 @@ package dev.flutter.scenariosui;
|
||||
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import dev.flutter.scenarios.PlatformViewsActivity;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
@@ -8,10 +8,10 @@ import android.app.Instrumentation;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import dev.flutter.scenarios.PlatformViewsActivity;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
|
||||
@@ -8,10 +8,10 @@ import android.app.Instrumentation;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import dev.flutter.scenarios.PlatformViewsActivity;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
@@ -6,9 +6,9 @@ package dev.flutter.scenariosui;
|
||||
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import dev.flutter.scenarios.SpawnedEngineActivity;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
@@ -6,9 +6,9 @@ package dev.flutter.scenariosui;
|
||||
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.filters.LargeTest;
|
||||
import androidx.test.rule.ActivityTestRule;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
import dev.flutter.scenarios.SpawnMultiEngineActivity;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
|
||||
Reference in New Issue
Block a user