However, this means that ALL script exceptions will be hidden, which is usually not a good thing - you should try and catch script exceptions for your own code. So, you should only use the above code when it is absolutely necessary (I use a mocking approach).

NicelyResynchronizingAjaxController

To use the NicelyResynchronizingAjaxController in your JUnit 4 project, you can use the following code: