TransactionFlow { public <R1> TransactionFlow<T,R1> flatMap(Function<R,TransactionFlow<T,R1>> fn){ return of(transactionTemplate,a -> fn.apply(transaction.apply(a)).transaction.apply(a)); }  TransactionFlow<T,R1> map(Function<R,R1> fn); TransactionFlow<T,R> peek(Consumer<R> c); TransactionFlow<T,R1> flatMap(Function<R,TransactionFlow<T,R1>> fn); Try<R,Throwable> execute(T input); Try<R,Ex> execute(T input,Class<Ex> classes); static TransactionFlow<T,R> of(TransactionTemplate transactionManager,Function<T,R> fn); static TransactionFlow<T,T> of(TransactionTemplate transactionManager);  }
@Test public void flatMapTest() { String result = TransactionFlow.of(transactionTemplate, this::load) .flatMap(this::newTransaction) .execute(10) .orElse(""); assertThat(result, equalTo("data:10")); }