Skip to content

Commit

Permalink
Add Object overloads for dynamic language support.
Browse files Browse the repository at this point in the history
Need these until we finish work at ReactiveX/RxJava#204
  • Loading branch information
benjchristensen committed Jun 5, 2013
1 parent 68a0527 commit ce81da0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/test/groovy/rx/lang/groovy/ObservableTests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;

import java.util.Arrays;
import java.util.Collection;
import java.util.Map;

import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;

import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import rx.Notification;
import rx.Observable;
import rx.Observer;
import rx.Subscription;
import rx.observables.GroupedObservable;
import rx.subscriptions.Subscriptions;
import rx.util.functions.Func1;

Expand Down Expand Up @@ -280,6 +284,29 @@ def class ObservableTests {
Observable.from(1, 2, 3).all({ x -> x > 0 }).subscribe({ result -> a.received(result) });
verify(a, times(1)).received(true);
}

@Test
public void testGroupBy() {
int count=0;

Observable.from("one", "two", "three", "four", "five", "six")
.groupBy({String s -> s.length()})
.mapMany({
groupObservable ->

return groupObservable.map({
s ->
return "Value: " + s + " Group: " + groupObservable.getKey();
});
}).toBlockingObservable().forEach({
s ->
println(s);
count++;
})

assertEquals(6, count);
}


def class AsyncObservable implements Func1<Observer<Integer>, Subscription> {

Expand Down

0 comments on commit ce81da0

Please sign in to comment.