File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed
src/test/java/rx/internal/operators Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 17
17
18
18
import static org .junit .Assert .assertEquals ;
19
19
import static org .junit .Assert .assertFalse ;
20
+ import static org .junit .Assert .assertTrue ;
20
21
import static org .mockito .Mockito .mock ;
21
22
import static org .mockito .Mockito .never ;
22
23
import static org .mockito .Mockito .times ;
26
27
import java .util .Arrays ;
27
28
import java .util .Collections ;
28
29
import java .util .List ;
30
+ import java .util .concurrent .atomic .AtomicBoolean ;
29
31
import java .util .concurrent .atomic .AtomicInteger ;
30
32
31
33
import org .junit .Test ;
@@ -77,7 +79,7 @@ public void call(Integer t1) {
77
79
}
78
80
79
81
@ Test
80
- public void testRangeWithOverflow () {
82
+ public void testRangeWithZero () {
81
83
Observable .range (1 , 0 );
82
84
}
83
85
@@ -220,4 +222,31 @@ public void onNext(Integer t) {
220
222
}});
221
223
assertEquals (n , count .get ());
222
224
}
225
+
226
+ @ Test
227
+ public void testEmptyRangeSendsOnCompleteEagerlyWithRequestZero () {
228
+ final AtomicBoolean completed = new AtomicBoolean (false );
229
+ Observable .range (1 , 0 ).subscribe (new Subscriber <Integer >() {
230
+
231
+ @ Override
232
+ public void onStart () {
233
+ request (0 );
234
+ }
235
+
236
+ @ Override
237
+ public void onCompleted () {
238
+ completed .set (true );
239
+ }
240
+
241
+ @ Override
242
+ public void onError (Throwable e ) {
243
+
244
+ }
245
+
246
+ @ Override
247
+ public void onNext (Integer t ) {
248
+
249
+ }});
250
+ assertTrue (completed .get ());
251
+ }
223
252
}
You can’t perform that action at this time.
0 commit comments