### Question:
FlatMapStageFactory implements ProcessingStageFactory<Stage.FlatMap> { @Override public <I, O> ProcessingStage<I, O> create(Engine engine, Stage.FlatMap stage) { Function<I, Graph> mapper = Casts.cast(stage.getMapper()); return new FlatMapStage<>(engine, mapper); }  @Override ProcessingStage<I, O> create(Engine engine, Stage.FlatMap stage);  }### Answer:
@Test public void create() throws ExecutionException, InterruptedException { Multi<Integer> publisher = Multi.createFrom().items(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); List<String> list = ReactiveStreams.fromPublisher(publisher) .filter(i -> i < 4) .flatMap(this::duplicate) .flatMapCompletionStage(this::asString) .toList() .run().toCompletableFuture().get(); assertThat(list).containsExactly("1", "1", "2", "2", "3", "3"); }
@SuppressWarnings("ConstantConditions") @Test public void createWithoutStage() { assertThrows(NullPointerException.class, () -> factory.create(null, null)); }
@Test public void createWithoutFunction() { assertThrows(NullPointerException.class, () -> factory.create(null, () -> null)); }