IllegalStateException

3 views
Skip to first unread message

apillai

unread,
Jun 23, 2010, 8:54:20 PM6/23/10
to easytesting
Hi,

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)

Alex Ruiz

unread,
Jun 24, 2010, 4:57:13 PM6/24/10
to easyt...@googlegroups.com
I find it very difficult to understand/troubleshoot the issue just by
looking at the posted code. Can you please file a ticket in our JIRA,
and attach a little project (Eclipse or IDEA are ok) that reproduces
the problem?

Thanks,
-Alex

> --
> You received this message because you are subscribed to the Google Groups "easytesting" group.
> To post to this group, send email to easyt...@googlegroups.com.
> To unsubscribe from this group, send email to easytesting...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/easytesting?hl=en.
>
>

apillai

unread,
Jun 24, 2010, 11:32:41 PM6/24/10
to easytesting
I have created a ticket FEST-366 Illegalstate exception is thrown for
an editable JComboBox. And have attached the code to reproduce it.

Thanks!

Anita


On Jun 24, 1:57 pm, Alex Ruiz <alex.ruiz...@gmail.com> wrote:
> I find it very difficult to understand/troubleshoot the issue just by
> looking at the posted code. Can you please file a ticket in our JIRA,
> and attach a little project (Eclipse or IDEA are ok) that reproduces
> the problem?
>
> Thanks,
> -Alex
>

Alex Ruiz

unread,
Jun 25, 2010, 1:59:14 PM6/25/10
to easyt...@googlegroups.com
Thanks Anita :)

-Alex

Reply all
Reply to author
Forward
0 new messages