From 541b46a3ea51b9a8bcd22d6b8b90e58e5390f959 Mon Sep 17 00:00:00 2001 From: Abubkr Hago <24502430+abubkr-hago@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:36:29 +0400 Subject: [PATCH] fix: ParseUriHttpBodyTest.testInitializeWithUri and ParseUriHttpBodyTest.testWriteTo --- .../java/com/parse/ParseUriHttpBodyTest.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/parse/src/test/java/com/parse/ParseUriHttpBodyTest.java b/parse/src/test/java/com/parse/ParseUriHttpBodyTest.java index 8e472195..180d6870 100644 --- a/parse/src/test/java/com/parse/ParseUriHttpBodyTest.java +++ b/parse/src/test/java/com/parse/ParseUriHttpBodyTest.java @@ -10,18 +10,35 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import android.content.Context; import android.net.Uri; +import androidx.test.platform.app.InstrumentationRegistry; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; -public class ParseUriHttpBodyTest { +@RunWith(RobolectricTestRunner.class) +public class ParseUriHttpBodyTest extends ResetPluginsParseTest { @Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder(); + @Before + public void setup() throws Exception { + super.setUp(); + Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); + ParsePlugins plugins = mock(ParsePlugins.class); + when(plugins.applicationContext()).thenReturn(context); + ParsePlugins.set(plugins); + } + @Test public void testInitializeWithUri() throws IOException { byte[] content = {1, 1, 1, 1, 1};