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 1717
1818import static org .junit .Assert .assertEquals ;
1919import static org .junit .Assert .assertFalse ;
20+ import static org .junit .Assert .assertTrue ;
2021import static org .mockito .Mockito .mock ;
2122import static org .mockito .Mockito .never ;
2223import static org .mockito .Mockito .times ;
2627import java .util .Arrays ;
2728import java .util .Collections ;
2829import java .util .List ;
30+ import java .util .concurrent .atomic .AtomicBoolean ;
2931import java .util .concurrent .atomic .AtomicInteger ;
3032
3133import org .junit .Test ;
@@ -77,7 +79,7 @@ public void call(Integer t1) {
7779 }
7880
7981 @ Test
80- public void testRangeWithOverflow () {
82+ public void testRangeWithZero () {
8183 Observable .range (1 , 0 );
8284 }
8385
@@ -220,4 +222,31 @@ public void onNext(Integer t) {
220222 }});
221223 assertEquals (n , count .get ());
222224 }
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+ }
223252}
You can’t perform that action at this time.
0 commit comments