The instantiation SceneDock
wait a little (10 sec by default, i guess) until a jemmy fx
application is launched.
During this wait, it lookups periodically (each 100ms by default) if a window have been opened by executing a task in the javafx thread
(using Platform.runLater(Runnable)
).
Invoking Platform.runLater(Runnable)
when no application have been launched, a java.lang.IllegalStateException
is thrown, caught and print to the error output:
java.lang.IllegalStateException: Toolkit not initialized
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:153)
at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:148)
...
If no application have been done after a while, you should get a org.jemmy.TimeoutExpiredException
:
org.jemmy.TimeoutExpiredException: State 'Waiting for 1 javafx.scene.Scene controls to be found adhering to org.jemmy.lookup.Any@65e7c41f' has not been reached in 10000 milliseconds
at org.jemmy.timing.Waiter.ensureState(Waiter.java:121)
at org.jemmy.lookup.AbstractLookup.wait(AbstractLookup.java:138)
...
I get this behavior with the following code :
import org.jemmy.TimeoutExpiredException;
import org.jemmy.fx.SceneDock;
import org.junit.Test;
public class TestX {
@Test
public void notInitializedToolkit() {
try {
new SceneDock();
} catch (TimeoutExpiredException e) {
System.err.println("The application have not been launched");
}
}
}