title: Configuring JBehave to run multithread TestNG tests
body: <p>I'm trying to create a Proof-of-Concept of using JBehave and TestNG together. What I want to do, is to run a story simultaneously in multiple threads in order to test my codes thread safety.</p>
  
  <p>I have a simple class that only does one thing, calculates modulo 7 on a given integer value. I've created a simple BDD test for this class. I've set up my BDD test as described in JBehave "<a href="http://jbehave.org/reference/stable/getting-started.html" rel="nofollow">Getting started</a>" documentation. The only difference is, that in my JUnitStory file, instead of using JUnit's @Test annotation, I've used TestNG's</p>
  
  <pre><code>@org.testng.annotations.Test(threadPoolSize = 10, invocationCount = 100, timeOut = 10000)
  </code></pre>
  
  <p>When I run the test, everything goes fine for the first 70-90% of the cases, then an exception occurs and the rest of the runs fail</p>
  
  <pre><code>===============================================
      Default test
      Tests run: 100, Failures: 11, Skips: 0
  ===============================================
  </code></pre>
  
  <p>The exception that occurs is </p>
  
  <pre><code>FAILED: run
  java.util.concurrent.RejectedExecutionException
      at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1774)
      at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:768)
      at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:656)
      at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:92)
      at org.jbehave.core.embedder.StoryManager.submit(StoryManager.java:203)
      at org.jbehave.core.embedder.StoryManager.runningStory(StoryManager.java:138)
      at org.jbehave.core.embedder.StoryManager.filterRunning(StoryManager.java:122)
      at org.jbehave.core.embedder.StoryManager.runningStoriesAsPaths(StoryManager.java:107)
      at org.jbehave.core.embedder.StoryManager.performStories(StoryManager.java:93)
      at org.jbehave.core.embedder.StoryManager.runStories(StoryManager.java:81)
  ....
  </code></pre>
  
  <p>I'm relatively new to both JBehave and TestNG, so I was wondering if this could be simply a configuration issue or is it actually a bug in JBehave.</p>