diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2015-01-06 11:04:20 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2015-01-06 11:05:37 +0100 |
| commit | 5dff962101d1bc4aa26f4f18b381162e47bcea22 (patch) | |
| tree | ba906a043b8b72642f7b41981b8cf6251c140a90 | |
| parent | 8fdb2c5067c4bcb0c73568b06be2156a42ef23d2 (diff) | |
| download | cgeo-5dff962101d1bc4aa26f4f18b381162e47bcea22.zip cgeo-5dff962101d1bc4aa26f4f18b381162e47bcea22.tar.gz cgeo-5dff962101d1bc4aa26f4f18b381162e47bcea22.tar.bz2 | |
Alternate workaround for missing method in tests
This one has the advantage of not requiring any extra code in the
application itself.
| -rw-r--r-- | main/proguard-project.txt | 3 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/utils/RxUtilsTest.java | 12 |
2 files changed, 11 insertions, 4 deletions
diff --git a/main/proguard-project.txt b/main/proguard-project.txt index 114ebf8..a1682d9 100644 --- a/main/proguard-project.txt +++ b/main/proguard-project.txt @@ -70,9 +70,6 @@ -keep class org.apache.commons.lang3.StringUtils { *; } -keep class org.apache.commons.io.IOUtils { *; } -keep class org.apache.commons.io.FileUtils { *; } --keepclassmembers class rx.Observable { - public static Observable<Integer> range(int, int); -} # action providers are only referenced from XML -keep public class cgeo.geocaching.sorting.SortActionProvider { *; } 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<Integer> range = ReplaySubject.createWithSize(10); + static { + for (int i = 1; i <= 10; i++) { + range.onNext(i); + } + range.onCompleted(); + } + public static void testTakeUntil() { - final Observable<Integer> observable = Observable.range(1, 10).lift(RxUtils.operatorTakeUntil(new Func1<Integer, Boolean>() { + final Observable<Integer> observable = range.lift(RxUtils.operatorTakeUntil(new Func1<Integer, Boolean>() { @Override public Boolean call(final Integer value) { return value > 6; |
