File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
rxjava-core/src/test/java/rx Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1027,4 +1027,29 @@ public Observable<String> call(String s) {
1027
1027
});
1028
1028
o .subscribe ();
1029
1029
}
1030
+
1031
+ @ Test
1032
+ public void testTakeWhileToList () {
1033
+ int [] nums = {1 , 2 , 3 };
1034
+ final AtomicInteger count = new AtomicInteger ();
1035
+ for (final int n : nums ) {
1036
+ Observable
1037
+ .from (Boolean .TRUE , Boolean .FALSE )
1038
+ .takeWhile (new Func1 <Boolean , Boolean >() {
1039
+ @ Override
1040
+ public Boolean call (Boolean value ) {
1041
+ return value ;
1042
+ }
1043
+ })
1044
+ .toList ()
1045
+ .doOnNext (new Action1 <List <Boolean >>() {
1046
+ @ Override
1047
+ public void call (List <Boolean > booleans ) {
1048
+ count .incrementAndGet ();
1049
+ }
1050
+ })
1051
+ .subscribe ();
1052
+ }
1053
+ assertEquals (nums .length , count .get ());
1054
+ }
1030
1055
}
You can’t perform that action at this time.
0 commit comments