summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparentej <parentej@google.com>2017-01-19 10:52:14 +0000
committerparentej <parentej@google.com>2017-01-24 09:59:29 +0000
commitf3df355d66432d24b466faf1ccc4cfd22f690fbc (patch)
tree02e86ac661662f3ddaaa5d84aac5492d3a7cb301
parent59538a153774c89663f7b6d28a7f8f9dda09a85c (diff)
downloadswing-testing-f3df355d66432d24b466faf1ccc4cfd22f690fbc.tar.gz
Dead lock when Dialog/FrameFixture's are created by name
If the name of the created Dialog/FrameFixture can't be found, it throws a ComponentLookupException, and the tests that run after that will dead lock. 1 - All constructors that call robotWithCurrentAwtHierarchy() have the potential to dead lock, if sometime later during the object construction there is some exception. 2 - There is an implicit (hidden) dependency between this constructors and BasicRobot, but there is a chance that we want to create a specialised version of the robot. 3 - Is very easy to create and instance of BasicRobot. Test: Run DialogFixture_constructor_withName_Test in "repeat mode" Change-Id: Ie9f6947e7f46b22e26aeb94966f519b4f1c3e8b7
-rwxr-xr-x[-rw-r--r--]fest-swing/src/main/java/org/fest/swing/fixture/AbstractWindowFixture.java45
-rwxr-xr-x[-rw-r--r--]fest-swing/src/main/java/org/fest/swing/fixture/Containers.java14
-rwxr-xr-xfest-swing/src/main/java/org/fest/swing/fixture/DialogFixture.java28
-rwxr-xr-xfest-swing/src/main/java/org/fest/swing/fixture/FrameFixture.java26
-rwxr-xr-x[-rw-r--r--]fest-swing/src/test/java/org/fest/swing/applet/AppletViewer_TestCase.java28
-rwxr-xr-x[-rw-r--r--]fest-swing/src/test/java/org/fest/swing/finder/FEST250_findJOptionPaneWithNullParent.java28
-rwxr-xr-x[-rw-r--r--]fest-swing/src/test/java/org/fest/swing/fixture/Containers_Test.java48
-rwxr-xr-x[-rw-r--r--]fest-swing/src/test/java/org/fest/swing/fixture/DialogFixture_constructor_withDialog_Test.java14
-rwxr-xr-x[-rw-r--r--]fest-swing/src/test/java/org/fest/swing/fixture/DialogFixture_constructor_withName_Test.java13
-rwxr-xr-x[-rw-r--r--]fest-swing/src/test/java/org/fest/swing/fixture/FrameFixture_constructor_withFrame_Test.java13
-rwxr-xr-x[-rw-r--r--]fest-swing/src/test/java/org/fest/swing/fixture/FrameFixture_constructor_withName_Test.java11
11 files changed, 68 insertions, 200 deletions
diff --git a/fest-swing/src/main/java/org/fest/swing/fixture/AbstractWindowFixture.java b/fest-swing/src/main/java/org/fest/swing/fixture/AbstractWindowFixture.java
index c9f1b140..ad8edec0 100644..100755
--- a/fest-swing/src/main/java/org/fest/swing/fixture/AbstractWindowFixture.java
+++ b/fest-swing/src/main/java/org/fest/swing/fixture/AbstractWindowFixture.java
@@ -14,8 +14,6 @@
*/
package org.fest.swing.fixture;
-import static org.fest.swing.core.BasicRobot.robotWithCurrentAwtHierarchy;
-
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Window;
@@ -23,7 +21,6 @@ import java.awt.Window;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import org.fest.swing.core.BasicRobot;
import org.fest.swing.core.Robot;
import org.fest.swing.driver.ComponentDriver;
import org.fest.swing.driver.WindowDriver;
@@ -43,20 +40,6 @@ import org.fest.swing.lock.ScreenLock;
*/
public abstract class AbstractWindowFixture<S, C extends Window, D extends WindowDriver> extends
AbstractContainerFixture<S, C, D> implements WindowLikeContainerFixture<S>, JPopupMenuInvokerFixture {
- /**
- * Creates a new {@link AbstractWindowFixture}. This constructor creates a new {@link Robot} containing the current AWT
- * hierarchy.
- *
- * @param selfType the "self type."
- * @param type the type of {@code Window} to find using the created {@code Robot}.
- * @throws NullPointerException if the given {@code Window} type is {@code null}.
- * @throws ComponentLookupException if a {@code Window} having a matching type could not be found.
- * @throws ComponentLookupException if more than one {@code Window} having a matching type is found.
- * @see BasicRobot#robotWithCurrentAwtHierarchy()
- */
- public AbstractWindowFixture(@Nonnull Class<S> selfType, @Nonnull Class<? extends C> type) {
- this(selfType, robotWithCurrentAwtHierarchy(), type);
- }
/**
* Creates a new {@link AbstractWindowFixture}.
@@ -74,22 +57,6 @@ public abstract class AbstractWindowFixture<S, C extends Window, D extends Windo
}
/**
- * Creates a new {@link AbstractWindowFixture}. This constructor creates a new {@link Robot} containing the current AWT
- * hierarchy.
- *
- * @param selfType the "self type."
- * @param name the name of the {@code Window} to find.
- * @param type the type of {@code Window} to find using the created {@code Robot}.
- * @throws NullPointerException if the given {@code Window} type is {@code null}.
- * @throws ComponentLookupException if a {@code Window} having a matching name could not be found.
- * @throws ComponentLookupException if more than one {@code Window} having a matching name is found.
- * @see BasicRobot#robotWithCurrentAwtHierarchy()
- */
- public AbstractWindowFixture(@Nonnull Class<S> selfType, @Nullable String name, @Nonnull Class<? extends C> type) {
- this(selfType, robotWithCurrentAwtHierarchy(), name, type);
- }
-
- /**
* Creates a new {@link AbstractWindowFixture}.
*
* @param selfType the "self type."
@@ -107,18 +74,6 @@ public abstract class AbstractWindowFixture<S, C extends Window, D extends Windo
}
/**
- * Creates a new {@link AbstractWindowFixture}. This constructor creates a new {@link Robot} containing the current AWT
- * hierarchy.
- *
- * @param selfType the "self type."
- * @param target the {@code Window} to be managed by this fixture.
- * @throws NullPointerException if the given target {@code Window} is {@code null}.
- */
- public AbstractWindowFixture(@Nonnull Class<S> selfType, @Nonnull C target) {
- this(selfType, robotWithCurrentAwtHierarchy(), target);
- }
-
- /**
* Creates a new {@link AbstractWindowFixture}.
*
* @param selfType the "self type."
diff --git a/fest-swing/src/main/java/org/fest/swing/fixture/Containers.java b/fest-swing/src/main/java/org/fest/swing/fixture/Containers.java
index 1bb29ab8..f721be3c 100644..100755
--- a/fest-swing/src/main/java/org/fest/swing/fixture/Containers.java
+++ b/fest-swing/src/main/java/org/fest/swing/fixture/Containers.java
@@ -44,14 +44,15 @@ public final class Containers {
* <strong>Note:</strong>This method creates a new {@link Robot}. When using this method, please do not create any
* additional instances of {@code Robot}. Only one instance of {@code Robot} can exist per test class.
* </p>
- *
+ *
+ * @param robot performs user events on the given window and verifies expected output.
* @param contentPane the {@code Container} to use as content pane for the {@code JFrame} to create.
* @return the created {@code FrameFixture}.
* @see #frameFor(Container)
*/
@RunsInEDT
- public static @Nonnull FrameFixture showInFrame(@Nonnull Container contentPane) {
- FrameFixture frameFixture = frameFixtureFor(contentPane);
+ public static @Nonnull FrameFixture showInFrame(@Nonnull Robot robot, @Nonnull Container contentPane) {
+ FrameFixture frameFixture = frameFixtureFor(robot, contentPane);
frameFixture.show();
return frameFixture;
}
@@ -64,14 +65,15 @@ public final class Containers {
* <strong>Note:</strong>This method creates a new {@link Robot}. When using this method, please do not create any
* additional instances of {@code Robot}. Only one instance of {@code Robot} can exist per test class.
* </p>
- *
+ *
+ * @param robot performs user events on the given window and verifies expected output.
* @param contentPane the {@code Container} to use as content pane for the {@code JFrame} to create.
* @return the created {@code FrameFixture}.
* @see #frameFor(Container)
*/
@RunsInEDT
- public static @Nonnull FrameFixture frameFixtureFor(@Nonnull Container contentPane) {
- return new FrameFixture(frameFor(contentPane));
+ public static @Nonnull FrameFixture frameFixtureFor(@Nonnull Robot robot, @Nonnull Container contentPane) {
+ return new FrameFixture(robot, frameFor(contentPane));
}
/**
diff --git a/fest-swing/src/main/java/org/fest/swing/fixture/DialogFixture.java b/fest-swing/src/main/java/org/fest/swing/fixture/DialogFixture.java
index 535606e2..d1215df8 100755
--- a/fest-swing/src/main/java/org/fest/swing/fixture/DialogFixture.java
+++ b/fest-swing/src/main/java/org/fest/swing/fixture/DialogFixture.java
@@ -19,13 +19,10 @@ import java.awt.Dialog;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import org.fest.swing.core.BasicRobot;
import org.fest.swing.core.Robot;
import org.fest.swing.driver.DialogDriver;
import org.fest.swing.exception.ComponentLookupException;
-import static org.fest.util.Preconditions.checkNotNull;
-
/**
* Supports functional testing of {@code Dialog}s.
*
@@ -33,18 +30,6 @@ import static org.fest.util.Preconditions.checkNotNull;
*/
public class DialogFixture extends AbstractWindowFixture<DialogFixture, Dialog, DialogDriver> {
/**
- * Creates a new {@link DialogFixture}. This constructor creates a new {@link Robot} containing the current AWT
- * hierarchy.
- *
- * @param target the {@code Dialog} to be managed by this fixture.
- * @throws NullPointerException if {@code target} is {@code null}.
- * @see BasicRobot#robotWithCurrentAwtHierarchy()
- */
- public DialogFixture(@Nonnull Dialog target) {
- super(DialogFixture.class, checkNotNull(target));
- }
-
- /**
* Creates a new {@link DialogFixture}.
*
* @param robot performs simulation of user events on the given {@code Dialog}.
@@ -69,19 +54,6 @@ public class DialogFixture extends AbstractWindowFixture<DialogFixture, Dialog,
super(DialogFixture.class, robot, dialogName, Dialog.class);
}
- /**
- * Creates a new {@link DialogFixture}. This constructor creates a new {@link Robot} containing the current AWT
- * hierarchy.
- *
- * @param dialogName the name of the {@code Dialog} to find.
- * @throws ComponentLookupException if a {@code Dialog} having a matching name could not be found.
- * @throws ComponentLookupException if more than one {@code Dialog} having a matching name is found.
- * @see BasicRobot#robotWithCurrentAwtHierarchy()
- */
- public DialogFixture(@Nullable String dialogName) {
- super(DialogFixture.class, dialogName, Dialog.class);
- }
-
@Override
protected @Nonnull DialogDriver createDriver(@Nonnull Robot robot) {
return new DialogDriver(robot);
diff --git a/fest-swing/src/main/java/org/fest/swing/fixture/FrameFixture.java b/fest-swing/src/main/java/org/fest/swing/fixture/FrameFixture.java
index cae5fb16..b24b9c2e 100755
--- a/fest-swing/src/main/java/org/fest/swing/fixture/FrameFixture.java
+++ b/fest-swing/src/main/java/org/fest/swing/fixture/FrameFixture.java
@@ -19,14 +19,11 @@ import java.awt.Frame;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import org.fest.swing.core.BasicRobot;
import org.fest.swing.core.Robot;
import org.fest.swing.driver.FrameDriver;
import org.fest.swing.exception.ActionFailedException;
import org.fest.swing.exception.ComponentLookupException;
-import static org.fest.util.Preconditions.checkNotNull;
-
/**
* Supports functional testing of {@code Frame}s.
*
@@ -35,17 +32,6 @@ import static org.fest.util.Preconditions.checkNotNull;
*/
public class FrameFixture extends AbstractWindowFixture<FrameFixture, Frame, FrameDriver> implements
FrameLikeFixture<FrameFixture> {
- /**
- * Creates a new {@link FrameFixture}. This constructor creates a new {@link Robot} containing the current AWT
- * hierarchy.
- *
- * @param target the {@code Frame} to be managed by this fixture.
- * @throws NullPointerException if the given frame is {@code null}.
- * @see BasicRobot#robotWithCurrentAwtHierarchy()
- */
- public FrameFixture(@Nonnull Frame target) {
- super(FrameFixture.class, checkNotNull(target));
- }
/**
* Creates a new {@link FrameFixture}.
@@ -72,18 +58,6 @@ public class FrameFixture extends AbstractWindowFixture<FrameFixture, Frame, Fra
super(FrameFixture.class, robot, name, Frame.class);
}
- /**
- * Creates a new {@link FrameFixture}. This constructor creates a new {@link Robot} containing the current AWT
- * hierarchy.
- *
- * @param name the name of the {@code Frame} to find.
- * @throws ComponentLookupException if a {@code Frame} having a matching name could not be found.
- * @throws ComponentLookupException if more than one {@code Frame} having a matching name is found.
- */
- public FrameFixture(@Nullable String name) {
- super(FrameFixture.class, name, Frame.class);
- }
-
@Override
protected @Nonnull FrameDriver createDriver(@Nonnull Robot robot) {
return new FrameDriver(robot);
diff --git a/fest-swing/src/test/java/org/fest/swing/applet/AppletViewer_TestCase.java b/fest-swing/src/test/java/org/fest/swing/applet/AppletViewer_TestCase.java
index 771de8f9..3980776b 100644..100755
--- a/fest-swing/src/test/java/org/fest/swing/applet/AppletViewer_TestCase.java
+++ b/fest-swing/src/test/java/org/fest/swing/applet/AppletViewer_TestCase.java
@@ -23,31 +23,38 @@ import org.fest.swing.annotation.RunsInEDT;
import org.fest.swing.edt.GuiQuery;
import org.fest.swing.edt.GuiTask;
import org.fest.swing.fixture.FrameFixture;
-import org.fest.swing.test.core.EDTSafeTestCase;
+import org.fest.swing.test.core.RobotBasedTestCase;
import org.fest.swing.test.swing.TestApplet;
import org.fest.swing.timing.Condition;
-import org.junit.After;
-import org.junit.Before;
/**
* Base class for GUI tests for {@link AppletViewer}.
*
* @author Alex Ruiz
*/
-public abstract class AppletViewer_TestCase extends EDTSafeTestCase {
+public abstract class AppletViewer_TestCase extends RobotBasedTestCase {
TestApplet applet;
FrameFixture fixture; // TODO should not depend on fixture
AppletViewer viewer;
- @Before
- public final void setUp() {
+ @Override
+ public final void onSetUp() {
applet = createApplet();
viewer = createViewer();
- fixture = new FrameFixture(viewer);
+ fixture = new FrameFixture(robot, viewer);
fixture.show();
assertThatIsInitializedAndStarted(applet);
}
+ @Override
+ public final void onTearDown() {
+ unloadAppletIn(viewer);
+ assertThatAppletIsStoppedAndDestroyed();
+ if (fixture != null) {
+ fixture.cleanUp();
+ }
+ }
+
@RunsInEDT
final AppletViewer createViewer() {
return AppletViewer.newViewer(applet);
@@ -74,13 +81,6 @@ public abstract class AppletViewer_TestCase extends EDTSafeTestCase {
});
}
- @After
- public final void tearDown() {
- unloadAppletIn(viewer);
- assertThatAppletIsStoppedAndDestroyed();
- fixture.cleanUp();
- }
-
@RunsInEDT
private static void unloadAppletIn(final AppletViewer viewer) {
invokeLater(new Runnable() {
diff --git a/fest-swing/src/test/java/org/fest/swing/finder/FEST250_findJOptionPaneWithNullParent.java b/fest-swing/src/test/java/org/fest/swing/finder/FEST250_findJOptionPaneWithNullParent.java
index 9d4a4fc9..64cd08a5 100644..100755
--- a/fest-swing/src/test/java/org/fest/swing/finder/FEST250_findJOptionPaneWithNullParent.java
+++ b/fest-swing/src/test/java/org/fest/swing/finder/FEST250_findJOptionPaneWithNullParent.java
@@ -14,19 +14,14 @@
*/
package org.fest.swing.finder;
-import static org.fest.swing.edt.GuiActionRunner.execute;
import static org.fest.swing.finder.JOptionPaneFinder.findOptionPane;
import javax.swing.JOptionPane;
-import org.fest.swing.core.BasicRobot;
-import org.fest.swing.core.Robot;
import org.fest.swing.edt.GuiQuery;
import org.fest.swing.fixture.JOptionPaneFixture;
-import org.fest.swing.test.core.EDTSafeTestCase;
+import org.fest.swing.test.core.RobotBasedTestCase;
import org.fest.swing.test.swing.JOptionPaneLauncher;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
/**
@@ -34,24 +29,11 @@ import org.junit.Test;
*
* @author Alex Ruiz
*/
-public class FEST250_findJOptionPaneWithNullParent extends EDTSafeTestCase {
- private Robot robot;
+public class FEST250_findJOptionPaneWithNullParent extends RobotBasedTestCase {
- @Before
- public void setUp() {
- JOptionPane optionPane = execute(new GuiQuery<JOptionPane>() {
- @Override
- protected JOptionPane executeInEDT() {
- return new JOptionPane("Hello World!");
- }
- });
- JOptionPaneLauncher.launch(optionPane);
- robot = BasicRobot.robotWithCurrentAwtHierarchy();
- }
-
- @After
- public void tearDown() {
- robot.cleanUp();
+ @Override
+ public void onSetUp() {
+ JOptionPaneLauncher.launch(GuiQuery.get(() -> new JOptionPane("Hello World!")));
}
@Test
diff --git a/fest-swing/src/test/java/org/fest/swing/fixture/Containers_Test.java b/fest-swing/src/test/java/org/fest/swing/fixture/Containers_Test.java
index bf7cf1af..94469918 100644..100755
--- a/fest-swing/src/test/java/org/fest/swing/fixture/Containers_Test.java
+++ b/fest-swing/src/test/java/org/fest/swing/fixture/Containers_Test.java
@@ -17,7 +17,6 @@ package org.fest.swing.fixture;
import static java.awt.GridBagConstraints.REMAINDER;
import static javax.swing.BorderFactory.createEmptyBorder;
import static org.fest.assertions.Assertions.assertThat;
-import static org.fest.swing.edt.GuiActionRunner.execute;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -30,7 +29,7 @@ import javax.swing.JPasswordField;
import javax.swing.JTextField;
import org.fest.swing.edt.GuiQuery;
-import org.junit.Before;
+import org.fest.swing.test.core.RobotBasedTestCase;
import org.junit.Test;
/**
@@ -38,47 +37,34 @@ import org.junit.Test;
*
* @author Alex Ruiz
*/
-public class Containers_Test {
+public class Containers_Test extends RobotBasedTestCase{
private MyPanel panel;
+ private FrameFixture frameFixture;
- @Before
- public void setUp() {
- panel = execute(new GuiQuery<MyPanel>() {
- @Override
- protected MyPanel executeInEDT() {
- return new MyPanel();
- }
- });
+ @Override
+ public void onSetUp() {
+ panel = GuiQuery.get(() -> new MyPanel());
+ }
+
+ @Override
+ public void onTearDown() {
+ if (frameFixture != null) {
+ frameFixture.cleanUp();
+ }
}
@Test
public void should_show_container_in_JFrame() {
- FrameFixture frameFixture = null;
- try {
- frameFixture = Containers.showInFrame(panel);
- frameFixture.requireShowing();
- assertThat(frameFixture.target()).isNotNull();
- } finally {
- cleanUp(frameFixture);
- }
+ frameFixture = Containers.showInFrame(robot, panel);
+ frameFixture.requireShowing();
+ assertThat(frameFixture.target()).isNotNull();
}
@Test
public void should_place_Container_in_JFrame_without_showing() {
- FrameFixture frameFixture = null;
- try {
- frameFixture = Containers.frameFixtureFor(panel);
+ frameFixture = Containers.frameFixtureFor(robot, panel);
frameFixture.requireNotVisible();
assertThat(frameFixture.target()).isNotNull();
- } finally {
- cleanUp(frameFixture);
- }
- }
-
- private void cleanUp(FrameFixture frameFixture) {
- if (frameFixture != null) {
- frameFixture.cleanUp();
- }
}
private static class MyPanel extends JPanel {
diff --git a/fest-swing/src/test/java/org/fest/swing/fixture/DialogFixture_constructor_withDialog_Test.java b/fest-swing/src/test/java/org/fest/swing/fixture/DialogFixture_constructor_withDialog_Test.java
index 0db61e99..90ea9dd8 100644..100755
--- a/fest-swing/src/test/java/org/fest/swing/fixture/DialogFixture_constructor_withDialog_Test.java
+++ b/fest-swing/src/test/java/org/fest/swing/fixture/DialogFixture_constructor_withDialog_Test.java
@@ -19,8 +19,7 @@ import static org.fest.swing.test.builder.JDialogs.dialog;
import java.awt.Dialog;
-import org.fest.swing.test.core.EDTSafeTestCase;
-import org.junit.After;
+import org.fest.swing.test.core.RobotBasedTestCase;
import org.junit.Test;
/**
@@ -29,11 +28,12 @@ import org.junit.Test;
* @author Alex Ruiz
* @author Yvonne Wang
*/
-public class DialogFixture_constructor_withDialog_Test extends EDTSafeTestCase {
+public class DialogFixture_constructor_withDialog_Test extends RobotBasedTestCase {
private DialogFixture fixture;
- @After
- public void tearDown() {
+
+ @Override
+ public void onTearDown() {
if (fixture != null) {
fixture.cleanUp();
}
@@ -42,13 +42,13 @@ public class DialogFixture_constructor_withDialog_Test extends EDTSafeTestCase {
@Test
public void should_create_new_Robot_and_use_given_dialog_as_target() {
Dialog target = dialog().createNew();
- fixture = new DialogFixture(target);
+ fixture = new DialogFixture(robot, target);
assertThat(fixture.robot()).isNotNull();
assertThat(fixture.target()).isSameAs(target);
}
@Test(expected = NullPointerException.class)
public void should_throw_error_if_dialog_is_null() {
- fixture = new DialogFixture((Dialog) null);
+ fixture = new DialogFixture(robot, (Dialog) null);
}
}
diff --git a/fest-swing/src/test/java/org/fest/swing/fixture/DialogFixture_constructor_withName_Test.java b/fest-swing/src/test/java/org/fest/swing/fixture/DialogFixture_constructor_withName_Test.java
index 6950e332..bfba422d 100644..100755
--- a/fest-swing/src/test/java/org/fest/swing/fixture/DialogFixture_constructor_withName_Test.java
+++ b/fest-swing/src/test/java/org/fest/swing/fixture/DialogFixture_constructor_withName_Test.java
@@ -20,8 +20,7 @@ import static org.fest.swing.test.builder.JDialogs.dialog;
import java.awt.Dialog;
import org.fest.swing.exception.ComponentLookupException;
-import org.fest.swing.test.core.EDTSafeTestCase;
-import org.junit.After;
+import org.fest.swing.test.core.RobotBasedTestCase;
import org.junit.Test;
/**
@@ -30,11 +29,11 @@ import org.junit.Test;
* @author Alex Ruiz
* @author Yvonne Wang
*/
-public class DialogFixture_constructor_withName_Test extends EDTSafeTestCase {
+public class DialogFixture_constructor_withName_Test extends RobotBasedTestCase {
private DialogFixture fixture;
- @After
- public void tearDown() {
+ @Override
+ public void onTearDown() {
if (fixture != null) {
fixture.cleanUp();
}
@@ -45,13 +44,13 @@ public class DialogFixture_constructor_withName_Test extends EDTSafeTestCase {
Dialog target = dialog().withName("dialog")
.withTitle(getClass().getSimpleName())
.createAndShow();
- fixture = new DialogFixture("dialog");
+ fixture = new DialogFixture(robot, "dialog");
assertThat(fixture.robot()).isNotNull();
assertThat(fixture.target()).isSameAs(target);
}
@Test(expected = ComponentLookupException.class)
public void should_throw_error_if_dialog_with_matching_name_is_not_found() {
- fixture = new DialogFixture("dialog");
+ fixture = new DialogFixture(robot, "dialog");
}
}
diff --git a/fest-swing/src/test/java/org/fest/swing/fixture/FrameFixture_constructor_withFrame_Test.java b/fest-swing/src/test/java/org/fest/swing/fixture/FrameFixture_constructor_withFrame_Test.java
index 8b9596bd..b6b017df 100644..100755
--- a/fest-swing/src/test/java/org/fest/swing/fixture/FrameFixture_constructor_withFrame_Test.java
+++ b/fest-swing/src/test/java/org/fest/swing/fixture/FrameFixture_constructor_withFrame_Test.java
@@ -19,8 +19,7 @@ import static org.fest.swing.test.builder.JFrames.frame;
import java.awt.Frame;
-import org.fest.swing.test.core.EDTSafeTestCase;
-import org.junit.After;
+import org.fest.swing.test.core.RobotBasedTestCase;
import org.junit.Test;
/**
@@ -28,11 +27,11 @@ import org.junit.Test;
*
* @author Alex Ruiz
*/
-public class FrameFixture_constructor_withFrame_Test extends EDTSafeTestCase {
+public class FrameFixture_constructor_withFrame_Test extends RobotBasedTestCase {
private FrameFixture fixture;
- @After
- public void tearDown() {
+ @Override
+ public void onTearDown() {
if (fixture != null) {
fixture.cleanUp();
}
@@ -41,13 +40,13 @@ public class FrameFixture_constructor_withFrame_Test extends EDTSafeTestCase {
@Test
public void should_create_new_Robot_and_use_given_frame_as_target() {
Frame target = frame().createNew();
- fixture = new FrameFixture(target);
+ fixture = new FrameFixture(robot, target);
assertThat(fixture.robot()).isNotNull();
assertThat(fixture.target()).isSameAs(target);
}
@Test(expected = NullPointerException.class)
public void should_throw_error_if_Frame_is_null() {
- fixture = new FrameFixture((Frame) null);
+ fixture = new FrameFixture(robot, (Frame) null);
}
}
diff --git a/fest-swing/src/test/java/org/fest/swing/fixture/FrameFixture_constructor_withName_Test.java b/fest-swing/src/test/java/org/fest/swing/fixture/FrameFixture_constructor_withName_Test.java
index 946f878a..b79cd41e 100644..100755
--- a/fest-swing/src/test/java/org/fest/swing/fixture/FrameFixture_constructor_withName_Test.java
+++ b/fest-swing/src/test/java/org/fest/swing/fixture/FrameFixture_constructor_withName_Test.java
@@ -19,8 +19,7 @@ import static org.fest.swing.test.builder.JFrames.frame;
import java.awt.Frame;
-import org.fest.swing.test.core.EDTSafeTestCase;
-import org.junit.After;
+import org.fest.swing.test.core.RobotBasedTestCase;
import org.junit.Test;
/**
@@ -28,11 +27,11 @@ import org.junit.Test;
*
* @author Alex Ruiz
*/
-public class FrameFixture_constructor_withName_Test extends EDTSafeTestCase {
+public class FrameFixture_constructor_withName_Test extends RobotBasedTestCase {
private FrameFixture fixture;
- @After
- public void tearDown() {
+ @Override
+ public void onTearDown() {
if (fixture != null) {
fixture.cleanUp();
}
@@ -43,7 +42,7 @@ public class FrameFixture_constructor_withName_Test extends EDTSafeTestCase {
Frame target = frame().withName("frame")
.withTitle(getClass().getSimpleName())
.createAndShow();
- fixture = new FrameFixture("frame");
+ fixture = new FrameFixture(robot, "frame");
assertThat(fixture.robot()).isNotNull();
assertThat(fixture.target()).isSameAs(target);
}