In my GUI code, I have two types of threads functioning:
1.
Java threads in the model fetching data from the server. These threads help in doing some background processing (lazy loading).
2. Swing threads (I dont have any control/reference to it) that function beyond my control in the events like "fireTableRowChanged.." etc.
The first type of threads can be easily controlled by me because I have references to them (I use a factory to generate them and I can easily mock them by mocking the factory). But the later ones are beyond my control and these are the ones which I need to control. I need to mock them so that all the threads in my junit tests become synchronous!