When running unit test using FEST Swing, if an exception is thrown by tested or other classes in the EDT, the exception is captched by an AWT-EventQueue and the unit test still run "as nothing happend".
The exception is not rethrown and the unit test ignore its existence. The only thing we get is the logging of the exception in the standard error console.
Would it be possible to rethrow the exception to the unit test, in order to get a failed test with the exception as a cause ? It would be great to have this feature.
In attachments, you will a unit test where the problem is reproduced.
The use case is simple. The frame shows a textfield and three buttons. When user clicks on one of the button, the text field is refreshed with text returned by MyService's implementation of sayHello() or sayGoodbye() or both.
The unit test creates a mock of MyService and a FrameFixture of MyFrame. It contains three unit test methods:
1) the first one for the test of sayHello button
2) a second for the test of sayGoodbye button
3) a third for the test of sayBoth button
In this last one, the sayGoodbye method behavior of mockService is not defined, to reproduce the problem that I described (an AssertionError is thrown and logged into the console).
When the third test method is launched, FEST will click on the button "btnSayBoth" and call the behavior defined on mockService. The behavior sayGoodbye is not defined and an AssertionError is thrown by EasyMock.
This assertion fault is catched by AWT, logged in the error console and the unit test continue --> The textfield fixture is checked by Fest and requireText failed.
The AssertionError should be thrown before the TextField fixture is checked