KentBeck/junit — pull request #391 by jerolimov (2012-02-28 21:01:17+00:00)
Title: TestRunner for concurrency problems

Hello,

i write an extension for junit to check common concurrency problems,
for example on parallel SimpleDateFormat or HashMap usage.
And i originally write this already in the issue 387 - but notice now that
it's better to push it to your pull requests. Sorry for the duplication.

Thank you for your feedback here or in the issue 387 where
different people already discussed the theoretically problems behind
concurrency testing: https://github.com/KentBeck/junit/issues/387

But the code is tested in a real project and it's simple enough for all
standard usecases so i want to push it into the upstream to share
it with other developers. And maybe another dev could use or extend
it anytime...

It requires only a @RunWith (Runner) configuration on the test class
and a @Concurrency configuration annotation with options for
* times -- Number of times a single test method will be called.
* parallelThreads -- Number of threads which will be created for each test method.
* expectAtLeast -- Expected exceptions means "allowed" exceptions...
* expectMinimumSuccessRuns -- Number of ...
* expectMaximumSuccessRuns -- Number of ...

Annotation source:

https://github.com/jerolimov/junit/blob/master/src/main/java/org/junit/concurrency/Concurrency.java

Example source:

https://github.com/jerolimov/junit/blob/master/src/test/java/org/junit/concurrency/HashMapTest.java

Already some feedback here:

https://github.com/KentBeck/junit/issues/387

It would be nice if you could a look on it. Feel free to make comments
or wishes for the code. Otherwise you want to take it into the main repo?