phamow / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

Throwing IllegalComponentStateException when aborting a running Fest Unit Test #301

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi

I am using Fest for the first time. This is my first unit test.
It is working fine. But I have now added the EmergencyAbortListener to 
abort the unit test. It works about 50% of the time. But the other 50% I 
am getting an error. Not sure why. The trace is given below. 

What steps will reproduce the problem?
1. Running the unit test in Eclipse
2. Click Ctrl+Shift+A to abort the test.
3.

What is the expected output? What do you see instead?
Expected output - Unit test passed.
Instead I see the following error:java.awt.IllegalComponentStateException: 
component must be showing on the screen to determine its location

What version of the product are you using? On what operating system?
Fest-Swing 1.0

Please provide any additional information below.

Stack Trace

java.awt.IllegalComponentStateException: component must be showing on the 
screen to determine its location
    at java.awt.Component.getLocationOnScreen_NoTreeLock
(Component.java:1828)
    at java.awt.Component.getLocationOnScreen(Component.java:1802)
    at javax.swing.JPopupMenu.show(JPopupMenu.java:893)
    at javax.swing.plaf.basic.BasicComboPopup.show
(BasicComboPopup.java:191)
    at javax.swing.plaf.basic.BasicComboBoxUI.setPopupVisible
(BasicComboBoxUI.java:861)
    at javax.swing.JComboBox.setPopupVisible(JComboBox.java:796)
    at javax.swing.JComboBox.showPopup(JComboBox.java:781)
    at 
au.gov.wa.dpi.trelis.app.vehicle.common.VehicleMakeComboBoxFestTest$2.execu
teInEDT(VehicleMakeComboBoxFestTest.java:231)
    at org.fest.swing.edt.GuiTask.run(GuiTask.java:37)
    at java.awt.event.InvocationEvent.dispatch
(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters
(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter
(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy
(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents
(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents
(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Original issue reported on code.google.com by nsre...@gmail.com on 5 Feb 2009 at 1:23

GoogleCodeExporter commented 9 years ago
Hi,

EmergencyAbortListener is meant to be used only in emergencies. For example, 
you can
use it if you are running a FEST test and all of a sudden you need to use your 
mouse
or your keyboard. By pressing Control-Shift-A you are telling 
EmergencyAbortListener
to forcibly terminate the test, you don't really care about the test results.

The reason you don't get an IllegalComponentStateException every single time is
because EmergencyAbortListener aborts the Swing application, not the test; they 
run
in different threads.
When you do get an IllegalComponentStateException, it probably is because FEST 
is
trying to access a component, but the listener disposed its top-level ancestor. 
See
the code in issue 174 for details.

I'm marking this issue invalid.

Best regards,
Csabi

Original comment by csaba.ju...@gmail.com on 5 Feb 2009 at 10:15

GoogleCodeExporter commented 9 years ago
Thanks Csabi.

Original comment by nsre...@gmail.com on 13 Feb 2009 at 1:31