Skip to content

Commit c899fad

Browse files
committed
Modified RetryWhen to match book
1 parent bd5d9d5 commit c899fad

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

tests/java/itrx/chapter3/error/RetryWhenTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package itrx.chapter3.error;
22

3-
import static org.junit.Assert.assertEquals;
4-
53
import java.io.IOException;
64
import java.util.Arrays;
75
import java.util.concurrent.TimeUnit;
@@ -29,8 +27,7 @@ public void example() {
2927

3028
source.retryWhen((o) -> o
3129
.take(2)
32-
.delay(100, TimeUnit.MILLISECONDS)
33-
.concatWith(Observable.error(new Exception("Done"))))
30+
.delay(100, TimeUnit.MILLISECONDS))
3431
.timeInterval()
3532
.subscribe(
3633
System.out::println,
@@ -62,14 +59,14 @@ public void test() {
6259
source.retryWhen((o) -> o
6360
.take(2)
6461
.delay(100, TimeUnit.MILLISECONDS, scheduler)
65-
.concatWith(Observable.error(new Exception("Done"))), scheduler)
62+
, scheduler)
6663
.timeInterval(scheduler)
6764
.map(i -> i.getIntervalInMilliseconds())
6865
.subscribe(intervals);
6966

7067
scheduler.advanceTimeBy(200, TimeUnit.MILLISECONDS);
7168
intervals.assertReceivedOnNext(Arrays.asList(0L, 0L, 100L, 0L, 100L, 0L));
7269
intervals.assertTerminalEvent();
73-
assertEquals(1, intervals.getOnErrorEvents().size());
70+
intervals.assertNoErrors();
7471
}
7572
}

0 commit comments

Comments
 (0)