Fixed ChartFragment tests.
Initialization of looper was missing.
package de.dennisguse.opentracks.fragments;
import android.location.Location;
+import android.os.Looper;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
+import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -44,6 +47,17 @@ public class ChartFragmentTest {
private ChartFragment chartFragment;
+ @BeforeClass
+ public static void preSetUp() {
+ // Prepare looper for Android's message queue
+ if (Looper.myLooper() == null) Looper.prepare();
+ }
+
+ @AfterClass
+ public static void finalTearDown() {
+ if (Looper.myLooper() != null) Looper.myLooper().quit();
+ }
+
@Before
public void setUp() {
boolean chartByDistance = false;
