Skip navigation.

Test Driven Thread Safety

Test Driven Thread Safety

How do you write a test that fails because of lacking thread safety? Well, in this case I could start up some threads, make sure that they used the collection methods simultaneously and then assert that only one thread was allowed to do so at a time.

That turned out to be more easy to think than to code.

Introduces the two problems and their solution.

Author: The Vertical Slice
Published: September 14, 2007