You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to test my custom JComboBox I get an
IllegalStateException for a very specific situation.
Abt my code, I have added my custom comboBox to a dummy frame which is
then assigned to a FrameFixture for testing purposes. All my other
tests for this comboBox run successfully except when I set it to
editable and try to enter text.
When .enterText("some value"); is executed an illegalStateException is
thrown.
I dug into the fest code and the JComboBoxDriver's
enterText(JComboBox comboBox, String text) method is called. In this
method a call is made to find the editor associated with the combobox
(note: I have not added any custom editors to my combobox) and call is
made to the focusAndWaitForFocusGain() method under ComponentDriver.
This method in turn calls assertIsEnabledAndShowing on the editor
which returns false because when the isShowing method under Component
class is called it returns false because its "peer" value has been set
to null.
I tried to replace my custom combo box with a dummy combo box and the
test executed without any issues. Any idea why this is happening and
what needs to be done?
Stack Trace:
java.lang.IllegalStateException: Expecting component
javax.swing.plaf.metal.MetalComboBoxEditor$1[name=null, text='',
enabled=true, visible=true, showing=false] to be showing on the screen
at
org.fest.swing.driver.ComponentStateValidator.componentNotShowingOnScreenFailure(ComponentStateValidator.java:
87)
at
org.fest.swing.driver.ComponentStateValidator.validateIsShowing(ComponentStateValidator.java:
72)
at
org.fest.swing.driver.ComponentStateValidator.validateIsEnabledAndShowing(ComponentStateValidator.java:
44)
at org.fest.swing.driver.ComponentDriver
$2.executeInEDT(ComponentDriver.java:499)
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)
at org.fest.swing.edt.GuiActionRunner.execute(GuiActionRunner.java:
97)
at
org.fest.swing.driver.ComponentDriver.assertIsEnabledAndShowing(ComponentDriver.java:
497)
at
org.fest.swing.driver.ComponentDriver.focusAndWaitForFocusGain(ComponentDriver.java:
362)
at
org.fest.swing.driver.JComboBoxDriver.enterText(JComboBoxDriver.java:
370)
at
org.fest.swing.fixture.JComboBoxFixture.enterText(JComboBoxFixture.java:
198)
at
com.irise.studio.editor.ComboBoxEditorViewTest.testFireValueChangedOnEnterKeyInEditableMode(ComboBoxEditorViewTest.java:
256)
Issue by anita pillai from Thu, 24 Jun 2010 22:31:23 -0500
Originally opened as http://jira.codehaus.org/browse/FEST-366
When I try to test my custom JComboBox I get an
IllegalStateException for a very specific situation.
Abt my code, I have added my custom comboBox to a dummy frame which is
then assigned to a FrameFixture for testing purposes. All my other
tests for this comboBox run successfully except when I set it to
editable and try to enter text.
This is the part of my code that fails:
...
comboBoxEditor.setEditable(true);
dummyFrameFixture.comboBox("comboBoxEditor").enterText("some value");
When .enterText("some value"); is executed an illegalStateException is
thrown.
I dug into the fest code and the JComboBoxDriver's
enterText(JComboBox comboBox, String text) method is called. In this
method a call is made to find the editor associated with the combobox
(note: I have not added any custom editors to my combobox) and call is
made to the focusAndWaitForFocusGain() method under ComponentDriver.
This method in turn calls assertIsEnabledAndShowing on the editor
which returns false because when the isShowing method under Component
class is called it returns false because its "peer" value has been set
to null.
I tried to replace my custom combo box with a dummy combo box and the
test executed without any issues. Any idea why this is happening and
what needs to be done?
Stack Trace:
java.lang.IllegalStateException: Expecting component
javax.swing.plaf.metal.MetalComboBoxEditor$1[name=null, text='',
enabled=true, visible=true, showing=false] to be showing on the screen
at
org.fest.swing.driver.ComponentStateValidator.componentNotShowingOnScreenFailure(ComponentStateValidator.java:
87)
at
org.fest.swing.driver.ComponentStateValidator.validateIsShowing(ComponentStateValidator.java:
72)
at
org.fest.swing.driver.ComponentStateValidator.validateIsEnabledAndShowing(ComponentStateValidator.java:
44)
at org.fest.swing.driver.ComponentDriver
$2.executeInEDT(ComponentDriver.java:499)
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)
at org.fest.swing.edt.GuiActionRunner.execute(GuiActionRunner.java:
97)
at
org.fest.swing.driver.ComponentDriver.assertIsEnabledAndShowing(ComponentDriver.java:
497)
at
org.fest.swing.driver.ComponentDriver.focusAndWaitForFocusGain(ComponentDriver.java:
362)
at
org.fest.swing.driver.JComboBoxDriver.enterText(JComboBoxDriver.java:
370)
at
org.fest.swing.fixture.JComboBoxFixture.enterText(JComboBoxFixture.java:
198)
at
com.irise.studio.editor.ComboBoxEditorViewTest.testFireValueChangedOnEnterKeyInEditableMode(ComboBoxEditorViewTest.java:
256)
votes (original issue): 0
watches (original issue): 0
The text was updated successfully, but these errors were encountered: