From 5dff962101d1bc4aa26f4f18b381162e47bcea22 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Tue, 6 Jan 2015 11:04:20 +0100 Subject: Alternate workaround for missing method in tests This one has the advantage of not requiring any extra code in the application itself. --- tests/src/cgeo/geocaching/utils/RxUtilsTest.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tests/src/cgeo/geocaching') diff --git a/tests/src/cgeo/geocaching/utils/RxUtilsTest.java b/tests/src/cgeo/geocaching/utils/RxUtilsTest.java index 5259998..2487184 100644 --- a/tests/src/cgeo/geocaching/utils/RxUtilsTest.java +++ b/tests/src/cgeo/geocaching/utils/RxUtilsTest.java @@ -6,13 +6,23 @@ import rx.Observable; import rx.Subscription; import rx.functions.Func1; import rx.subjects.PublishSubject; +import rx.subjects.ReplaySubject; import android.test.AndroidTestCase; public class RxUtilsTest extends AndroidTestCase { + // Observable.range(int, int) is not kept in the application by proguard. Use an explicit range here. + private static final ReplaySubject range = ReplaySubject.createWithSize(10); + static { + for (int i = 1; i <= 10; i++) { + range.onNext(i); + } + range.onCompleted(); + } + public static void testTakeUntil() { - final Observable observable = Observable.range(1, 10).lift(RxUtils.operatorTakeUntil(new Func1() { + final Observable observable = range.lift(RxUtils.operatorTakeUntil(new Func1() { @Override public Boolean call(final Integer value) { return value > 6; -- cgit v1.1