Closed
Description
With the latest 0.20.0-RC1 a combination of takeWhile() and toList() on an Observable fails, sometimes.
Here's a unit test that fails:
@Test
public void testTakeWhile() {
int[] nums = {1, 2, 3};
final AtomicInteger count = new AtomicInteger();
for(final int n: nums) {
Observable
.from(Boolean.TRUE, Boolean.FALSE)
.takeWhile(new Func1<Boolean, Boolean>() {
@Override
public Boolean call(Boolean value) {
return value;
}
})
.toList()
.doOnNext(new Action1<List<Boolean>>() {
@Override
public void call(List<Boolean> booleans) {
count.incrementAndGet();
}
})
.subscribe();
}
assertEquals(nums.length, count.get());
}
Here's the same unit test that passes with slight modification:
@Test
public void testTakeWhile() {
int[] nums = {1, 2, 3};
final AtomicInteger count = new AtomicInteger();
for(final int n: nums) {
Observable
.from(Boolean.TRUE, Boolean.FALSE, Boolean.FALSE)
.takeWhile(new Func1<Boolean, Boolean>() {
@Override
public Boolean call(Boolean value) {
return value;
}
})
.toList()
.doOnNext(new Action1<List<Boolean>>() {
@Override
public void call(List<Boolean> booleans) {
count.incrementAndGet();
}
})
.subscribe();
}
assertEquals(nums.length, count.get());
}
Metadata
Metadata
Assignees
Labels
No labels