@@ -261,7 +261,7 @@ public void testNoDownstreamUnsubscribe() {
261
261
262
262
@ Test
263
263
public void testBackpressure () {
264
- Flowable <Integer > source = Flowable . range ( 1 , 10 );
264
+ PublishProcessor <Integer > source = PublishProcessor . create ( );
265
265
PublishProcessor <Integer > other = PublishProcessor .create ();
266
266
267
267
Flowable <Integer > result = source .withLatestFrom (other , COMBINER );
@@ -274,17 +274,24 @@ public void testBackpressure() {
274
274
275
275
ts .request (1 );
276
276
277
+ source .onNext (1 );
278
+
277
279
assertTrue ("Other has no observers!" , other .hasSubscribers ());
278
280
279
281
ts .assertNoValues ();
280
282
281
283
other .onNext (1 );
282
284
283
- ts . request ( 1 );
285
+ source . onNext ( 2 );
284
286
285
287
ts .assertValue ((2 << 8 ) + 1 );
286
288
287
289
ts .request (5 );
290
+ source .onNext (3 );
291
+ source .onNext (4 );
292
+ source .onNext (5 );
293
+ source .onNext (6 );
294
+ source .onNext (7 );
288
295
ts .assertValues (
289
296
(2 << 8 ) + 1 , (3 << 8 ) + 1 , (4 << 8 ) + 1 , (5 << 8 ) + 1 ,
290
297
(6 << 8 ) + 1 , (7 << 8 ) + 1
@@ -717,4 +724,30 @@ public void zeroOtherCombinerReturnsNull() {
717
724
.test ()
718
725
.assertFailureAndMessage (NullPointerException .class , "The combiner returned a null value" );
719
726
}
727
+
728
+ @ Test
729
+ public void testSingleRequestNotForgottenWhenNoData () {
730
+ PublishProcessor <Integer > source = PublishProcessor .create ();
731
+ PublishProcessor <Integer > other = PublishProcessor .create ();
732
+
733
+ Flowable <Integer > result = source .withLatestFrom (other , COMBINER );
734
+
735
+ TestSubscriber <Integer > ts = new TestSubscriber <Integer >(0L );
736
+
737
+ result .subscribe (ts );
738
+
739
+ ts .request (1 );
740
+
741
+ source .onNext (1 );
742
+
743
+ ts .assertNoValues ();
744
+
745
+ other .onNext (1 );
746
+
747
+ ts .assertNoValues ();
748
+
749
+ source .onNext (2 );
750
+
751
+ ts .assertValue ((2 << 8 ) + 1 );
752
+ }
720
753
}
0 commit comments