Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegalstate exception is thrown for an editable JComboBox #70

Closed
croesch opened this issue Feb 8, 2014 · 3 comments
Closed

Illegalstate exception is thrown for an editable JComboBox #70

croesch opened this issue Feb 8, 2014 · 3 comments

Comments

@croesch
Copy link
Collaborator

croesch commented Feb 8, 2014

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

@croesch
Copy link
Collaborator Author

croesch commented Feb 8, 2014

Comment by apillai from Thu, 24 Jun 2010 22:31:24 -0500


Attachment MyClass.java (size=4387)

@croesch
Copy link
Collaborator Author

croesch commented Feb 8, 2014

Comment by apillai from Thu, 24 Jun 2010 22:31:24 -0500


Attachment MyClassTest.java (size=3437)

croesch added a commit to assertj/assertj-examples that referenced this issue Mar 14, 2016
@croesch croesch removed the Major label Mar 14, 2016
@croesch
Copy link
Collaborator Author

croesch commented Mar 14, 2016

Works fine for me. Cannot reproduce.

@croesch croesch closed this as completed Mar 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant