Skip to content

Commit

Permalink
Merge pull request #1472 from mattrjacobs/add-unit-test-to-operator-all
Browse files Browse the repository at this point in the history
Add test of backpressure to OperatorAll
  • Loading branch information
mattrjacobs committed Jul 22, 2014
2 parents 044cd53 + 3c2f259 commit 9f45065
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package rx.internal.operators;

import static org.junit.Assert.assertFalse;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
Expand All @@ -25,6 +26,8 @@
import rx.Observer;
import rx.functions.Func1;

import java.util.Arrays;

public class OperatorAllTest {

@Test
Expand Down Expand Up @@ -98,4 +101,16 @@ public Boolean call(String s) {
verify(observer).onError(error);
verifyNoMoreInteractions(observer);
}

@Test
public void testFollowingFirst() {
Observable<Integer> o = Observable.from(Arrays.asList(1, 3, 5, 6));
Observable<Boolean> allOdd = o.all(new Func1<Integer, Boolean>() {
@Override
public Boolean call(Integer i) {
return i % 2 == 1;
}
});
assertFalse(allOdd.toBlocking().first());
}
}

0 comments on commit 9f45065

Please sign in to comment.