fromStream creates a Project Reactor Flux from a Java Stream, publishing the stream’s elements as reactive data. section 11.3.1
@Test
public void createAFlux_fromStream() {
Stream<String> fruitStream =
Stream.of("Apple", "Orange", "Grape", "Banana", "Strawberry");
Flux<String> fruitFlux = Flux.fromStream(fruitStream);
StepVerifier.create(fruitFlux)
.expectNext("Apple")
.expectNext("Orange")
.expectNext("Grape")
.expectNext("Banana")
.expectNext("Strawberry")
.verifyComplete();
}
Build a fruit Stream, pass it to Flux.fromStream(), and verify the published values with StepVerifier. section 11.3.1
Fruit stream
The example emits Apple, Orange, Grape, Banana, and Strawberry in order, then verifies that the Flux completes. section 11.3.1
