Skip to content

Commit

Permalink
Failing unit test for reduce, showing it does not implement backpress…
Browse files Browse the repository at this point in the history
…ure correctly
  • Loading branch information
mattrjacobs committed Jul 29, 2014
1 parent 08bf50f commit 98778aa
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package rx.internal.operators;

import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
Expand Down Expand Up @@ -114,4 +115,18 @@ public Integer call(Integer t1) {
verify(observer, times(1)).onError(any(TestException.class));
}

@Test(timeout = 13000)
public void testBackpressure() throws InterruptedException {
Observable<Integer> source = Observable.from(1, 2, 3, 4, 5, 6);
Observable<Integer> reduced = source.reduce(new Func2<Integer, Integer, Integer>() {
@Override
public Integer call(Integer i1, Integer i2) {
return i1 + i2;
}
});

Integer r = reduced.toBlocking().first();
assertEquals(21, r.intValue());
}

}

0 comments on commit 98778aa

Please sign in to comment.