@@ -33,8 +33,7 @@ public void monoShouldMapValueToUpperCaseHelloWorld() {
33
33
34
34
Mono <String > mono = Mono .just ("Heisenberg" );
35
35
36
- // TODO: Replace this line to transform the emitted element to uppercase
37
- // mono = …
36
+ mono = mono .map (String ::toUpperCase );
38
37
39
38
StepVerifier .create (mono ).expectNext ("HEISENBERG" ).verifyComplete ();
40
39
}
@@ -44,8 +43,7 @@ public void fluxShouldMapValueToUpperCaseHelloWorld() {
44
43
45
44
Flux <String > flux = Flux .just ("Mike" , "Gustavo" );
46
45
47
- // TODO: Replace this line to transform the emitted element to uppercase
48
- // flux = …
46
+ flux = flux .map (String ::toUpperCase );
49
47
50
48
StepVerifier .create (flux ).expectNext ("MIKE" , "GUSTAVO" ).verifyComplete ();
51
49
}
@@ -55,8 +53,7 @@ public void monoShouldEmitIndividualCharactersAsString() {
55
53
56
54
Mono <String > mono = Mono .just ("Schraderbräu" );
57
55
58
- // TODO: Replace this line to emit each character as single element
59
- Flux <String > flux = Flux .empty ();
56
+ Flux <String > flux = mono .map (s -> s .split ("" )).flatMapMany (Flux ::fromArray );
60
57
61
58
StepVerifier .create (flux ).expectNext ("S" , "c" , "h" , "r" , "a" , "d" , "e" , "r" , "b" , "r" , "ä" , "u" ).verifyComplete ();
62
59
}
@@ -67,8 +64,7 @@ public void fluxShouldConcatTwoMonos() {
67
64
Mono <String > hello = Mono .just ("Breaking" );
68
65
Mono <String > world = Mono .just ("Bad" );
69
66
70
- // TODO: Replace this line to compose a stream from the two Monos
71
- Flux <String > flux = Flux .empty ();
67
+ Flux <String > flux = Flux .concat (hello , world );
72
68
73
69
StepVerifier .create (flux ).expectNext ("Breaking" , "Bad" ).verifyComplete ();
74
70
}
0 commit comments