diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/FabricUIManagerPullModelTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/FabricUIManagerPullModelTest.kt index e0796289dfc3..ee4ae40079e6 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/FabricUIManagerPullModelTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/FabricUIManagerPullModelTest.kt @@ -39,6 +39,7 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.Shadows.shadowOf import org.robolectric.annotation.Config import org.robolectric.shadow.api.Shadow @@ -76,7 +77,8 @@ class FabricUIManagerPullModelTest { fun setup() { ReactNativeFeatureFlagsForTests.setUp() overrideFeatureFlags() - reactContext = ReactTestHelper.createCatalystContextForTest() + reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) underTest = FabricUIManager( reactContext, diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/MountingManagerAnimatedPropsTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/MountingManagerAnimatedPropsTest.kt index f9f4f59e5795..4a3f6f936d3c 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/MountingManagerAnimatedPropsTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/MountingManagerAnimatedPropsTest.kt @@ -31,6 +31,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config @RunWith(RobolectricTestRunner::class) @@ -54,7 +55,8 @@ class MountingManagerAnimatedPropsTest { @Before fun setUp() { ReactNativeFeatureFlagsForTests.setUp() - val reactContext = ReactTestHelper.createCatalystContextForTest() + val reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) themedReactContext = ThemedReactContext(reactContext, reactContext, null, -1) mountingManager = MountingManager(ViewManagerRegistry(listOf>(ReactViewManager())), {}) diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt index 884078cdc72c..1e7e51deb722 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerSynchronousMountPropsTest.kt @@ -34,6 +34,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment import org.robolectric.annotation.Config /** @@ -65,7 +66,8 @@ class SurfaceMountingManagerSynchronousMountPropsTest { @Before fun setUp() { ReactNativeFeatureFlagsForTests.setUp() - val reactContext = ReactTestHelper.createCatalystContextForTest() + val reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) themedReactContext = ThemedReactContext(reactContext, reactContext, null, -1) mountingManager = MountingManager( diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt index f7372288b68f..a1282668eb23 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/fabric/SurfaceMountingManagerTest.kt @@ -20,11 +20,14 @@ import com.facebook.react.uimanager.ThemedReactContext import com.facebook.react.uimanager.ViewManager import com.facebook.react.uimanager.ViewManagerRegistry import com.facebook.react.views.view.ReactViewManager +import com.facebook.testutils.shadows.ShadowSoLoader import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import org.robolectric.RuntimeEnvironment +import org.robolectric.annotation.Config /** * Tests for [SurfaceMountingManager] view lifecycle around preallocateView, deleteView, and @@ -42,6 +45,7 @@ import org.robolectric.RobolectricTestRunner * See T223288217. */ @RunWith(RobolectricTestRunner::class) +@Config(shadows = [ShadowSoLoader::class]) class SurfaceMountingManagerTest { private lateinit var mountingManager: MountingManager private lateinit var themedReactContext: ThemedReactContext @@ -50,7 +54,8 @@ class SurfaceMountingManagerTest { @Before fun setUp() { ReactNativeFeatureFlagsForTests.setUp() - val reactContext = ReactTestHelper.createCatalystContextForTest() + val reactContext = + ReactTestHelper.createTestReactApplicationContext(RuntimeEnvironment.getApplication()) themedReactContext = ThemedReactContext(reactContext, reactContext, null, -1) mountingManager = MountingManager( diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java index 13ad5c6a95c3..329f88e2fee8 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerDelegateTest.java @@ -16,13 +16,17 @@ import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsForTests; import com.facebook.react.views.view.ReactViewGroup; import com.facebook.react.views.view.ReactViewManager; +import com.facebook.testutils.shadows.ShadowSoLoader; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) +@Config(shadows = ShadowSoLoader.class) public class BaseViewManagerDelegateTest { private ReactViewManager viewManager; private ReactViewGroup view; @@ -34,7 +38,9 @@ public void setUp() { // (non-JNI) accessor so Robolectric doesn't try to load react_featureflagsjni. ReactNativeFeatureFlagsForTests.INSTANCE.setUp(); viewManager = mock(ReactViewManager.class); - ReactApplicationContext context = ReactTestHelper.createCatalystContextForTest(); + ReactApplicationContext context = + ReactTestHelper.INSTANCE.createTestReactApplicationContext( + RuntimeEnvironment.getApplication()); ThemedReactContext themedReactContext = new ThemedReactContext(context, context, null, -1); view = new ReactViewGroup(themedReactContext); delegate = new BaseViewManagerDelegate<>(viewManager) {};