Я получаю следующее при попытке использовать BasicRobot (FEST). Я не знаю, как это исправить.
[ConditionalEventPump] Exception occurred during event dispatching:
java.lang.IllegalThreadStateException: Cannot call method from the event dispatcher thread
at org.fest.swing.core.BasicRobot.waitForIdle(BasicRobot.java:669)
at org.fest.swing.core.BasicRobot.waitForIdle(BasicRobot.java:654)
at org.fest.swing.core.BasicRobot.click(BasicRobot.java:426)
at org.fest.swing.core.BasicRobot.click(BasicRobot.java:387)
at org.fest.swing.core.BasicRobot.click(BasicRobot.java:372)
at org.fest.swing.core.BasicRobot.click(BasicRobot.java:360)
at org.fest.swing.driver.ComponentDriver.click(ComponentDriver.java:94)
at org.fest.swing.fixture.JButtonFixture.click(JButtonFixture.java:99)
Вот код:
BasicRobot robot = (BasicRobot) BasicRobot.robotWithCurrentAwtHierarchy()
MainFrame.button( "setup" ).click();
//Exception is thrown in this line
DialogFixture setupViewDialog = WindowFinder.findDialog( "setup" ).using( robot );
setupViewDialog.button( "Save" ).click();
Как я могу это исправить?