Skip to content

Commit

Permalink
Implemented lastOrDefault
Browse files Browse the repository at this point in the history
  • Loading branch information
mairbek committed Feb 28, 2013
1 parent 7f0c517 commit b1d8817
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/groovy/rx/lang/groovy/ObservableTests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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<Observer<Integer>, Subscription> {

public Subscription call(final Observer<Integer> observer) {
Expand Down

0 comments on commit b1d8817

Please sign in to comment.