diff --git a/src/test/groovy/rx/lang/groovy/ObservableTests.groovy b/src/test/groovy/rx/lang/groovy/ObservableTests.groovy index 8d4d4b6..7190f97 100644 --- a/src/test/groovy/rx/lang/groovy/ObservableTests.groovy +++ b/src/test/groovy/rx/lang/groovy/ObservableTests.groovy @@ -233,6 +233,18 @@ def class ObservableTests { } } + @Test + public void testLastOrDefault() { + def val = Observable.toObservable("one", "two").lastOrDefault("default", { x -> x.length() == 3}) + assertEquals("two", val) + } + + @Test + public void testLastOrDefault2() { + def val = Observable.toObservable("one", "two").lastOrDefault("default", { x -> x.length() > 3}) + assertEquals("default", val) + } + def class AsyncObservable implements Func1, Subscription> { public Subscription call(final Observer observer) {