From c19e43a78fdfc2947a634735fc5326612b191220 Mon Sep 17 00:00:00 2001 From: Ephraim Kigamba Date: Mon, 24 May 2021 15:53:24 +0300 Subject: [PATCH] Fix instrumentation tests - Move Mapbox instantiation to UI thread --- .../downloaders/MapBoxOfflineResourcesDownloaderTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/src/androidTest/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloaderTest.java b/library/src/androidTest/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloaderTest.java index 36e4c337..94e8d9d5 100644 --- a/library/src/androidTest/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloaderTest.java +++ b/library/src/androidTest/java/io/ona/kujaku/downloaders/MapBoxOfflineResourcesDownloaderTest.java @@ -64,10 +64,11 @@ public class MapBoxOfflineResourcesDownloaderTest extends BaseTest { public ExpectedException expectedException = ExpectedException.none(); @Before - public void setup() { + public void setup() throws Throwable { context = InstrumentationRegistry.getTargetContext(); MapBoxOfflineResourcesDownloader.instance = null; - Mapbox.getInstance(context, "sample-token"); + + uiThreadTestRule.runOnUiThread(() -> Mapbox.getInstance(context, "sample-token")); } @Test