@Test
public void shouldExecuteAllFunctionsAtTheSameTime() throws Exception {

	// Given
	CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> "SampleText");
	// When
	ExecutorService pool = Executors.newFixedThreadPool(4);
	CompletableFuture<Stream<Integer>> actualFuture = future.thenComposeAsync(
			fanOut(ImmutableList.of(
					text -> {
						waitThreeSecond();
						return 1;
					},
					text -> {
						waitThreeSecond();
						return 2;
					},
					text -> {
						waitThreeSecond();
						return 4;
					})
			)
	);
	// Then
	try {
		actualFuture.get(4, TimeUnit.SECONDS);
	} catch (TimeoutException e) {
		fail("Should have finished in less than four seconds");
	}
}