How to run concurrency unit test?

Posted by janetsmith on Stack Overflow See other posts from Stack Overflow or by janetsmith
Published on 2009-08-04T10:37:50Z Indexed on 2010/03/22 10:21 UTC
Read the original article Hit count: 515

Hi,

How to use junit to run concurrency test?

Let's say I have a class

public class MessageBoard
{
    public synchronized void postMessage(String message)
    {
    	....
    }

    public void updateMessage(Long id, String message)
    {
    	....
    }
}

I wan to test multiple access to this postMessage concurrently. Any advice on this? I wish to run this kind of concurrency test against all my setter functions (or any methodn that involves create/update/delete operation).

Thanks

© Stack Overflow or respective owner

Related posts about unit-testing

Related posts about junit