diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK index 1a885e2c0..bb7c09790 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/BUCK @@ -26,6 +26,7 @@ android_library( react_native_target("java/com/facebook/react/common:common"), react_native_target("java/com/facebook/react/cxxbridge:bridge"), react_native_target("java/com/facebook/react/devsupport:interfaces"), + react_native_target("java/com/facebook/react/module/annotations:annotations"), react_native_target("java/com/facebook/react/module/model:model"), react_native_target("java/com/facebook/react/modules/core:core"), react_native_target("java/com/facebook/react/modules/debug:interfaces"), diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/network/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/network/BUCK index 860ac4448..edd32f268 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/network/BUCK +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/network/BUCK @@ -10,6 +10,7 @@ android_library( react_native_dep("third-party/android/support/v4:lib-support-v4"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_target("java/com/facebook/react/bridge:bridge"), + react_native_target("java/com/facebook/react/module/annotations:annotations"), react_native_target("java/com/facebook/react/modules/core:core"), ], ) diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/network/NetworkRecordingModuleMock.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/network/NetworkRecordingModuleMock.java index bf1b4e232..a7bcd8337 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/network/NetworkRecordingModuleMock.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/network/NetworkRecordingModuleMock.java @@ -19,12 +19,14 @@ import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.bridge.WritableArray; import com.facebook.react.bridge.WritableMap; +import com.facebook.react.module.annotations.ReactModule; import com.facebook.react.modules.core.DeviceEventManagerModule; /** * Mock Networking module that records last request received by {@link #sendRequest} method and * returns reponse code and body that should be set with {@link #setResponse} */ +@ReactModule(name = "Networking", canOverrideExistingModule = true) public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule { public int mRequestCount = 0; @@ -108,6 +110,11 @@ public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule { mAbortedRequest = true; } + @Override + public boolean canOverrideExistingModule() { + return true; + } + private void onDataReceived(int requestId, String data) { WritableArray args = Arguments.createArray(); args.pushInt(requestId);