<NME> SensorsTest.java
<BEF> package cgeo.geocaching.sensors;

import cgeo.geocaching.MainActivity;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.utils.AngleUtils;

import android.test.ActivityInstrumentationTestCase2;

import java.util.concurrent.TimeUnit;

import io.reactivex.rxjava3.core.Observable;
import static org.assertj.core.api.Java6Assertions.assertThat;

public class SensorsTest extends ActivityInstrumentationTestCase2<MainActivity> {

    private Sensors sensors;

    public SensorsTest() {
        super(MainActivity.class);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        sensors = Sensors.getInstance();
        sensors.setupGeoDataObservables(Settings.useGooglePlayServices(), Settings.useLowPowerMode());
        sensors.setupDirectionObservable();
    }

        assertThat(angle == 1.0f || angle == 91.0f || angle == 181.0f || angle == 271.0f).isTrue();
    }

    private static <T> void testDataAvailability(final Observable<T> observable) {
        try {
            observable.timeout(2, TimeUnit.SECONDS).first().toBlocking().single();
        } catch (final Exception ignored) {
            observable.timeout(2, TimeUnit.SECONDS).blockingFirst();
        } catch (final Exception ignored) {
    }

    public void testDirectionObservable() {
        testDataAvailability(sensors.directionObservable());
    }

    public void testGeodataObservable() {
        testDataAvailability(sensors.geoDataObservable(false));
        testDataAvailability(sensors.geoDataObservable(true));
    }

}

}

<MSG> refactoring: mode codacy cleanups
<DFF> @@ -30,7 +30,7 @@ public class SensorsTest extends ActivityInstrumentationTestCase2<MainActivity>
         assertThat(angle == 1.0f || angle == 91.0f || angle == 181.0f || angle == 271.0f).isTrue();
     }
 
-    private static <T> void testDataAvailability(final Observable<T> observable) {
+    private static <T> void assertDataAvailability(final Observable<T> observable) {
         try {
             observable.timeout(2, TimeUnit.SECONDS).first().toBlocking().single();
         } catch (final Exception ignored) {
@@ -39,12 +39,12 @@ public class SensorsTest extends ActivityInstrumentationTestCase2<MainActivity>
     }
 
     public void testDirectionObservable() {
-        testDataAvailability(sensors.directionObservable());
+        assertDataAvailability(sensors.directionObservable());
     }
 
     public void testGeodataObservable() {
-        testDataAvailability(sensors.geoDataObservable(false));
-        testDataAvailability(sensors.geoDataObservable(true));
+        assertDataAvailability(sensors.geoDataObservable(false));
+        assertDataAvailability(sensors.geoDataObservable(true));
     }
 
 }

refactoring: mode codacy cleanups