Skip to content

Commit b6247fe

Browse files
committed
Consistent example format
1 parent 6a32dea commit b6247fe

File tree

13 files changed

+162
-155
lines changed

13 files changed

+162
-155
lines changed

tests/java/itrx/chapter4/backpressure/ConsumerSideTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public void exampleSample() {
2727
},
2828
System.out::println);
2929

30-
// 82
31-
// 182
32-
// 283
30+
// 82
31+
// 182
32+
// 283
3333
}
3434

3535
public void exampleBuffer() {
@@ -46,9 +46,9 @@ public void exampleBuffer() {
4646
},
4747
System.out::println);
4848

49-
// [0, 1, 2, 3, 4, 5, 6, 7]
50-
// [8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
51-
// [18, 19, 20, 21, 22, 23, 24, 25, 26, 27]
49+
// [0, 1, 2, 3, 4, 5, 6, 7]
50+
// [8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
51+
// [18, 19, 20, 21, 22, 23, 24, 25, 26, 27]
5252
}
5353

5454

tests/java/itrx/chapter4/backpressure/NoBackpressureTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public void exampleSynchronous() {
3232
} catch (Exception e) { }
3333
});
3434

35-
// 1
36-
// 2
35+
// 1
36+
// 2
3737
}
3838

3939
public void exampleNoBackpressure() {
@@ -48,9 +48,9 @@ public void exampleNoBackpressure() {
4848
},
4949
System.out::println);
5050

51-
// 0
52-
// 1
53-
// rx.exceptions.MissingBackpressureException
51+
// 0
52+
// 1
53+
// rx.exceptions.MissingBackpressureException
5454
}
5555

5656

tests/java/itrx/chapter4/backpressure/OnBackpressureTest.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ public void exampleOnBackpressureBuffer() {
3232
System.out::println
3333
);
3434

35-
// 0
36-
// 1
37-
// 2
38-
// 3
39-
// 4
40-
// 5
41-
// 6
42-
// 7
43-
// 8
44-
// 9
45-
// 10
46-
// 11
47-
// rx.exceptions.MissingBackpressureException: Overflowed buffer of 1000
35+
// 0
36+
// 1
37+
// 2
38+
// 3
39+
// 4
40+
// 5
41+
// 6
42+
// 7
43+
// 8
44+
// 9
45+
// 10
46+
// 11
47+
// rx.exceptions.MissingBackpressureException: Overflowed buffer of 1000
4848
}
4949

5050
public void exampleOnBackpressureDrop() {
@@ -60,15 +60,15 @@ public void exampleOnBackpressureDrop() {
6060
},
6161
System.out::println);
6262

63-
// 0
64-
// 1
65-
// 2
66-
// ...
67-
// 126
68-
// 127
69-
// 12861
70-
// 12862
71-
// ...
63+
// 0
64+
// 1
65+
// 2
66+
// ...
67+
// 126
68+
// 127
69+
// 12861
70+
// 12862
71+
// ...
7272
}
7373

7474

tests/java/itrx/chapter4/backpressure/ReactivePullTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ public void example() {
2323
tester.requestMore(2);
2424
System.out.println("Requesting 3 more");
2525
tester.requestMore(3);
26+
27+
// Requesting 2 more
28+
// Consumed 0
29+
// Consumed 1
30+
// Requesting 3 more
31+
// Consumed 2
32+
// Consumed 3
33+
// Consumed 4
2634
}
2735

2836

@@ -31,7 +39,6 @@ public void example() {
3139
//
3240

3341
@Test
34-
3542
public void test() {
3643
List<Integer> received = new ArrayList<>();
3744
ControlledPullSubscriber<Integer> tester = new ControlledPullSubscriber<Integer>(received::add);

tests/java/itrx/chapter4/coincidence/GroupJoinTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ public void example() {
6060
)
6161
.subscribe();
6262

63-
// L0: [R0, R1, R2]
64-
// L1: [R0, R1, R2]
65-
// L2: [R1, R2]
66-
// L3: [R1, R2]
67-
// L4: [R2]
68-
// L5: [R2]
63+
// L0: [R0, R1, R2]
64+
// L1: [R0, R1, R2]
65+
// L2: [R1, R2]
66+
// L3: [R1, R2]
67+
// L4: [R2]
68+
// L5: [R2]
6969
}
7070

7171

tests/java/itrx/chapter4/coincidence/JoinTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ public void exampleJoinSimple() {
5454
.take(10)
5555
.subscribe(System.out::println);
5656

57-
// L0 - R0
58-
// L1 - R0
59-
// L0 - R1
60-
// L1 - R1
61-
// L2 - R1
62-
// L3 - R1
63-
// L0 - R2
64-
// L1 - R2
65-
// L2 - R2
66-
// L3 - R2
57+
// L0 - R0
58+
// L1 - R0
59+
// L0 - R1
60+
// L1 - R1
61+
// L2 - R1
62+
// L3 - R1
63+
// L0 - R2
64+
// L1 - R2
65+
// L2 - R2
66+
// L3 - R2
6767
}
6868

6969
public void exampleJoin2Way() {
@@ -84,16 +84,16 @@ public void exampleJoin2Way() {
8484
.take(10)
8585
.subscribe(System.out::println);
8686

87-
// L0 - R0
88-
// L0 - R1
89-
// L1 - R1
90-
// L1 - R2
91-
// L2 - R2
92-
// L2 - R3
93-
// L3 - R3
94-
// L3 - R4
95-
// L4 - R4
96-
// L4 - R5
87+
// L0 - R0
88+
// L0 - R1
89+
// L1 - R1
90+
// L1 - R2
91+
// L2 - R2
92+
// L2 - R3
93+
// L3 - R3
94+
// L3 - R4
95+
// L4 - R4
96+
// L4 - R5
9797
}
9898

9999

tests/java/itrx/chapter4/coincidence/WindowTest.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ public void exampleParallel() {
2525
.window(3,1))
2626
.subscribe(System.out::println);
2727

28-
// 0
29-
// 1
30-
// 1
31-
// 2
32-
// 2
33-
// 2
34-
// 3
35-
// 3
36-
// 3
37-
// 4
38-
// 4
39-
// 4
28+
// 0
29+
// 1
30+
// 1
31+
// 2
32+
// 2
33+
// 2
34+
// 3
35+
// 3
36+
// 3
37+
// 4
38+
// 4
39+
// 4
4040
}
4141

4242
public void exampleByCount() {
@@ -45,11 +45,11 @@ public void exampleByCount() {
4545
.flatMap(o -> o.toList())
4646
.subscribe(System.out::println);
4747

48-
// [0, 1, 2]
49-
// [1, 2, 3]
50-
// [2, 3, 4]
51-
// [3, 4]
52-
// [4]
48+
// [0, 1, 2]
49+
// [1, 2, 3]
50+
// [2, 3, 4]
51+
// [3, 4]
52+
// [4]
5353

5454
}
5555

@@ -60,12 +60,12 @@ public void exampleByTime() {
6060
.flatMap(o -> o.toList())
6161
.subscribe(System.out::println);
6262

63-
// [0, 1]
64-
// [0, 1, 2]
65-
// [1, 2, 3]
66-
// [2, 3, 4]
67-
// [3, 4]
68-
// [4]
63+
// [0, 1]
64+
// [0, 1, 2]
65+
// [1, 2, 3]
66+
// [2, 3, 4]
67+
// [3, 4]
68+
// [4]
6969
}
7070

7171
public void exampleBySignal() {
@@ -77,11 +77,11 @@ public void exampleBySignal() {
7777
.flatMap(o -> o.toList())
7878
.subscribe(System.out::println);
7979

80-
// [1, 2]
81-
// [2, 3]
82-
// [3, 4]
83-
// [4]
84-
// []
80+
// [1, 2]
81+
// [2, 3]
82+
// [3, 4]
83+
// [4]
84+
// []
8585
}
8686

8787

tests/java/itrx/chapter4/scheduling/ObserveOnTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ public void exampleObserveOn() {
2121
.subscribe(i ->
2222
System.out.println("Received " + i + " on " + Thread.currentThread().getId()));
2323

24-
// Created on 1
25-
// Received 1 on 13
26-
// Received 2 on 13
24+
// Created on 1
25+
// Received 1 on 13
26+
// Received 2 on 13
2727
}
2828

2929
public void exampleObserveOnBeforeAfter() {
@@ -40,11 +40,11 @@ public void exampleObserveOnBeforeAfter() {
4040
System.out.println("After " + i + " on " + Thread.currentThread().getId()))
4141
.subscribe();
4242

43-
// Created on 1
44-
// Before 1 on 1
45-
// Before 2 on 1
46-
// After 1 on 13
47-
// After 2 on 13
43+
// Created on 1
44+
// Before 1 on 1
45+
// Before 2 on 1
46+
// After 1 on 13
47+
// After 2 on 13
4848
}
4949

5050

tests/java/itrx/chapter4/scheduling/SchedulerTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public void exampleScheduleFuture() {
3535
() -> System.out.println(System.currentTimeMillis()-start),
3636
5, TimeUnit.SECONDS);
3737

38-
// 5033
39-
// 5035
38+
// 5033
39+
// 5035
4040
}
4141

4242
public void exampleCancelWork() {
@@ -53,7 +53,7 @@ public void exampleCancelWork() {
5353
() -> System.out.println(System.currentTimeMillis()-start),
5454
5, TimeUnit.SECONDS);
5555

56-
// 5032
56+
// 5032
5757
}
5858

5959
public void exampleCancelWithInterrupt() throws InterruptedException {
@@ -70,7 +70,7 @@ public void exampleCancelWithInterrupt() throws InterruptedException {
7070
Thread.sleep(500);
7171
worker.unsubscribe();
7272

73-
// Action interrupted
73+
// Action interrupted
7474
}
7575

7676

tests/java/itrx/chapter4/scheduling/SchedulersTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ public void exampleImmediate() {
2727
System.out.println("End");
2828
});
2929

30-
// Start
31-
// Inner
32-
// End
30+
// Start
31+
// Inner
32+
// End
3333
}
3434

3535
public void exampleTrampoline() {
@@ -41,9 +41,9 @@ public void exampleTrampoline() {
4141
System.out.println("End");
4242
});
4343

44-
// Start
45-
// End
46-
// Inner
44+
// Start
45+
// End
46+
// Inner
4747
}
4848

4949
public void exampleNewThread() throws InterruptedException {
@@ -58,11 +58,11 @@ public void exampleNewThread() throws InterruptedException {
5858
Thread.sleep(500);
5959
worker.schedule(() -> printThread("Again"));
6060

61-
// Main on 1
62-
// Start on 11
63-
// End on 11
64-
// Inner on 11
65-
// Again on 11
61+
// Main on 1
62+
// Start on 11
63+
// End on 11
64+
// Inner on 11
65+
// Again on 11
6666
}
6767

6868

0 commit comments

Comments
 (0)