Skip to content

Commit

Permalink
Merge pull request #1469 from mattrjacobs/fix-tolist-backpressure
Browse files Browse the repository at this point in the history
ToList operator needs to ignore backpressure
  • Loading branch information
mattrjacobs committed Jul 22, 2014
2 parents 5c0f4eb + d81cbcd commit 044cd53
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public Subscriber<? super T> call(final Subscriber<? super List<T>> o) {

final List<T> list = new LinkedList<T>();

@Override
public void onStart() {
request(Long.MAX_VALUE);
}

@Override
public void onCompleted() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Arrays;
import java.util.List;

import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;

Expand Down Expand Up @@ -94,4 +95,11 @@ public void testListWithNullValue() {
verify(observer, Mockito.never()).onError(any(Throwable.class));
verify(observer, times(1)).onCompleted();
}

@Test
public void testListWithBlockingFirst() {
Observable<String> o = Observable.from(Arrays.asList("one", "two", "three"));
List<String> actual = o.toList().toBlocking().first();
Assert.assertEquals(Arrays.asList("one", "two", "three"), actual);
}
}

0 comments on commit 044cd53

Please sign in to comment.