Question

I tried to create a swing test using FEST, which simply clicks a button. Unfortunately, the test hangs while executing new FrameFixture(...). I'm instantiating a controller, which internally creates a view, which extends from JFrame. The method getView() provides me this JFrame.

@Override
protected void onSetUp() {
    drawingCalculator = new FrameFixture(createCalculator());
    drawingCalculator.show();
}

@RunsInEDT
private static MainWindow createCalculator() {
    return execute(new GuiQuery<MainWindow>() {
        protected MainWindow executeInEDT() {
            MainModel model = new MainModel();
            return new MainController(model).getView();
        }
    });
}

I can't get past the line with new FrameFixture(...). I debugged the test and it hangs in the framework at this point:

BasicRobot.class

 private static Object acquireScreenLock() {
   Object screenLockOwner = new Object();
   ScreenLock.instance().acquire(screenLockOwner);
   return screenLockOwner;
 }

Is this a framework bug or am I simply using the library wrongly?

Was it helpful?

Solution

I was using the wrong constructor. I should have been:

 drawingCalculator = new FrameFixture(robot(), createCalculator());

This will create a new robot for this testcase.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top