<NME> RxUtilsTest.java
<BEF> package cgeo.geocaching.utils;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

import io.reactivex.Maybe;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;

public class RxUtilsTest {

    @Test
    public void testRememberLast() {
        final PublishSubject<String> rawObservable = PublishSubject.create();
        final Observable<String> observable = RxUtils.rememberLast(rawObservable, "initial");

        // Check that the initial value is present, and is kept there
        assertThat(observable.blockingFirst()).isEqualTo("initial");
        assertThat(observable.blockingFirst()).isEqualTo("initial");

        // Check that if the observable is not subscribed, changes are not propagated (similar to not keeping the
        // inner disposable active).
        rawObservable.onNext("without subscribers");
        assertThat(observable.blockingFirst()).isEqualTo("initial");

        // Check that new values are propagated and cached
        final Disposable disposable = observable.subscribe();
        rawObservable.onNext("first");
        assertThat(observable.blockingFirst()).isEqualTo("first");
        disposable.dispose();
        assertThat(observable.blockingFirst()).isEqualTo("first");
    }
        assertThat(observable.blockingFirst()).isEqualTo("first");
    }

    public static void testFromNullable() {
        final Maybe<String> fromNull = RxUtils.fromNullable(null);
        assertThat(fromNull.blockingGet()).isNull();

        final Maybe<String> fromNonNull = RxUtils.fromNullable("foo");
        assertThat(fromNonNull.blockingGet()).isEqualTo("foo");
    }

    public static void testDeferredNullable() {
        final Maybe<String> fromNull = RxUtils.deferredNullable(new Callable<String>() {
            @Override
            public String call() {
                return null;
            }
        });
        assertThat(fromNull.blockingGet()).isNull();

        final Maybe<String> fromNonNull = RxUtils.deferredNullable(new Callable<String>() {
            @Override
            public String call() {
                return "foo";
            }
        });
        assertThat(fromNonNull.blockingGet()).isEqualTo("foo");
    }

    public static void testObservableCache() {
        final AtomicInteger counter = new AtomicInteger(0);
        final RxUtils.ObservableCache<String, Integer> cache = new RxUtils.ObservableCache<>(new Function<String, Observable<Integer>>() {
            return Observable.just(s.length());
        });
        assertThat(cache.get("a").blockingSingle()).isEqualTo(1);
        assertThat(counter.get()).isEqualTo(1);
        assertThat(cache.get("a").blockingSingle()).isEqualTo(1);
        assertThat(counter.get()).isEqualTo(1);
        assertThat(cache.get("bb").blockingSingle()).isEqualTo(2);
        assertThat(counter.get()).isEqualTo(2);
        assertThat(cache.get("bb").blockingSingle()).isEqualTo(2);
        assertThat(counter.get()).isEqualTo(2);
        assertThat(cache.get("a").blockingSingle()).isEqualTo(1);
        assertThat(counter.get()).isEqualTo(2);
    }

    @Test
    public void testDelayedUnsubscription() {
        final AtomicBoolean unsubscribed = new AtomicBoolean(false);
        Observable.never().doOnDispose(() -> unsubscribed.set(true)).lift(new RxUtils.DelayedUnsubscription<>(100, TimeUnit.MILLISECONDS)).subscribe().dispose();
        assertThat(unsubscribed.get()).isFalse();
        try {
            Thread.sleep(200);
        } catch (final InterruptedException ignored) {
            // ignore for tests
        }
        assertThat(unsubscribed.get()).isTrue();
    }

}

<MSG> Remove unused RxUtils.deferredNullable() and RxUtils.fromNullable()

RxUtils.deferredNullable() was an alias to Maybe.fromCallable()

<DFF> @@ -2,12 +2,10 @@ package cgeo.geocaching.utils;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import java.util.concurrent.Callable;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import io.reactivex.Maybe;
 import io.reactivex.Observable;
 import io.reactivex.disposables.Disposable;
 import io.reactivex.functions.Action;
@@ -38,32 +36,6 @@ public class RxUtilsTest extends TestCase {
         assertThat(observable.blockingFirst()).isEqualTo("first");
     }
 
-    public static void testFromNullable() {
-        final Maybe<String> fromNull = RxUtils.fromNullable(null);
-        assertThat(fromNull.blockingGet()).isNull();
-
-        final Maybe<String> fromNonNull = RxUtils.fromNullable("foo");
-        assertThat(fromNonNull.blockingGet()).isEqualTo("foo");
-    }
-
-    public static void testDeferredNullable() {
-        final Maybe<String> fromNull = RxUtils.deferredNullable(new Callable<String>() {
-            @Override
-            public String call() {
-                return null;
-            }
-        });
-        assertThat(fromNull.blockingGet()).isNull();
-
-        final Maybe<String> fromNonNull = RxUtils.deferredNullable(new Callable<String>() {
-            @Override
-            public String call() {
-                return "foo";
-            }
-        });
-        assertThat(fromNonNull.blockingGet()).isEqualTo("foo");
-    }
-
     public static void testObservableCache() {
         final AtomicInteger counter = new AtomicInteger(0);
         final RxUtils.ObservableCache<String, Integer> cache = new RxUtils.ObservableCache<>(new Function<String, Observable<Integer>>() {

Remove unused RxUtils.deferredNullable() and RxUtils.fromNullable()