title: How do I write a JUnit test case to test threads and events
body: <p>I have a java code which works in one (main) thread. From the main thread, i spawn a new thread in which I make a server call. After the server call is done, I am doing some work in the new thread and after that the code joins the main thread.</p>
  
  <p>I am using eclipse Jobs to do the server call.</p>
  
  <p>I want to know, how do I write a JUnit test case for this. </p>