package com.github.ferstl;

import java.util.Arrays;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;


public class ParallelStreamSupportTest {

  private ForkJoinPool workerPool;

  @Before
  public void before() {
    this.workerPool = new ForkJoinPool(1);
  }

  @After
  public void after() throws InterruptedException {
    this.workerPool.shutdown();
    this.workerPool.awaitTermination(1, TimeUnit.SECONDS);
  }


  @Test
  public void test() {
    ParallelStreamSupport.parallelStream(Arrays.asList("a"), this.workerPool)
        .forEach(e -> System.out.println(Thread.currentThread().getName()));
  }

}

@@ -38,22 +38,20 @@
 va.util.
-Arrays
+List
 ;%0Aimport
@@ -86,16 +86,58 @@
 inPool;%0A
+import java.util.concurrent.ForkJoinTask;%0A
 import j
@@ -166,16 +166,48 @@
 meUnit;%0A
+import java.util.regex.Pattern;%0A
 import o
@@ -268,369 +268,1163 @@
 nit.
-Test;%0A%0A%0Apublic class ParallelStreamSupportTest %7B%0A%0A  private ForkJoinPool workerPool;%0A%0A  @Before%0A  public void before() %7B%0A    this.workerPool = new ForkJoinPool(1);%0A  %7D%0A%0A  @After%0A  public void after() throws InterruptedException %7B%0A    this.workerPool.shutdown();%0A    this.workerPool.awaitTermination(1, TimeUnit.SECONDS);%0A  %7D%0A%0A%0A  @Test%0A  public void test() %7B%0A   
+Ignore;%0Aimport org.junit.Test;%0Aimport static java.util.Collections.singletonList;%0Aimport static java.util.stream.Collectors.toList;%0Aimport static org.hamcrest.Matchers.contains;%0Aimport static org.hamcrest.Matchers.matchesPattern;%0Aimport static org.junit.Assert.assertThat;%0A%0A%0Apublic class ParallelStreamSupportTest %7B%0A%0A  private static final Pattern FORK_JOIN_THREAD_NAME_PATTERN = Pattern.compile(%22ForkJoinPool-%5C%5Cd+-worker-%5C%5Cd+%22);%0A%0A  private ForkJoinPool workerPool;%0A%0A  @Before%0A  public void before() %7B%0A    this.workerPool = new ForkJoinPool(1);%0A  %7D%0A%0A  @After%0A  public void after() throws InterruptedException %7B%0A    this.workerPool.shutdown();%0A    this.workerPool.awaitTermination(1, TimeUnit.SECONDS);%0A  %7D%0A%0A  /**%0A   * Verify that we use the correct thread name pattern.%0A   */%0A  @Test%0A  public void testForkJoinPoolThreadNamePattern() %7B%0A    ForkJoinTask%3CString%3E task = ForkJoinTask.adapt(() -%3E Thread.currentThread().getName());%0A    String threadName = this.workerPool.invoke(task);%0A%0A    assertThat(threadName, matchesPattern(FORK_JOIN_THREAD_NAME_PATTERN));%0A  %7D%0A%0A  @Test%0A  @Ignore(%22Not yet implemented%22)%0A  public void collect() %7B%0A    List%3CString%3E result =
  Par
@@ -1461,17 +1461,17 @@
 eam(
-Arrays.as
+singleton
 List
@@ -1507,71 +1507,156 @@
    .
-forEach(e -%3E System.out.println(Thread.currentThread().getName(
+map(e -%3E Thread.currentThread().getName())%0A        .collect(toList());%0A%0A    assertThat(result, contains(matchesPattern(FORK_JOIN_THREAD_NAME_PATTERN
 )));

Add tets for thread name