From 95b7259a0b8a2312e661cbccba353104091074c4 Mon Sep 17 00:00:00 2001 From: "Loren M. Lang" Date: Sat, 29 Jan 2022 22:30:55 -0800 Subject: [PATCH] Don't run tests that require an SD card when it's not present The feature this tests verifies requires an SD card and will fail if it's not available. --- androidTest/java/org/aprsdroid/app/ProfileTests.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/androidTest/java/org/aprsdroid/app/ProfileTests.java b/androidTest/java/org/aprsdroid/app/ProfileTests.java index ee1e0a5c..069774e0 100644 --- a/androidTest/java/org/aprsdroid/app/ProfileTests.java +++ b/androidTest/java/org/aprsdroid/app/ProfileTests.java @@ -6,9 +6,11 @@ import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction; import static androidx.test.espresso.matcher.ViewMatchers.withText; import static org.hamcrest.Matchers.allOf; +import static org.junit.Assume.assumeTrue; import android.app.Instrumentation; import android.content.Intent; +import android.os.Environment; import androidx.test.core.app.ActivityScenario; import androidx.test.espresso.intent.Intents; @@ -34,6 +36,7 @@ public void tearDown() { @Test public void testThatExportProfileOpensTheChooser() { + assumeTrue(Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())); ActivityScenario scenario = ActivityScenario.launch(PrefsAct.class); Intents.intending(hasAction(Intent.ACTION_CHOOSER)).respondWith(new Instrumentation.ActivityResult(0, null)); openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());