<p>I have a Java service which now will execute in a batch mode. Multi threaded support is added to the service so for every batch request a thread pool will be dedicated to execute the batch. The question is how do I test this? I have functional tests that pass under the threaded version of the service but, somehow, I feel there must be an idiom for testing this.  </p>

There really isn't a "good" way to do this.  The best thing I can suggest would be TestNG, which allows you to annotate your test methods and cause them to be executed in
n
threads concurrently.  For example:
```
```
@Test(invocationCount=10, threadPool=10)
public void testSomethingConcurrently() {
    ...
}
```
```
My TestNG knowledge is rusty at best, but AFAIK that should invoke the
```
testSomethingConcurrently
```
method 10 times concurrently.  This is a nice and declarative way to run multi-threaded tests against your code.
You can of course do something similar in JUnit by spawning threads manually in a loop, but that's insanely ugly and difficult to work with.  I had to do this once for a project I was working on; those tests were a nightmare to deal with since their failures weren't always repeatable.
Concurrency testing is difficult and prone to frustration, due to its non-deterministic nature.  This is part of why there is such a big push these days to use better concurrency abstractions, ones which are easier to "reason about" and convince one's self of correctness.