org.fest.swing.fixture
Class WindowFixture<T extends Window>

java.lang.Object
  extended by org.fest.swing.fixture.ComponentFixture<T>
      extended by org.fest.swing.fixture.ContainerFixture<T>
          extended by org.fest.swing.fixture.WindowFixture<T>
Type Parameters:
T - the type of window handled by this fixture.
All Implemented Interfaces:
CommonComponentFixture, ComponentContainerFixture, FocusableComponentFixture, JPopupMenuInvokerFixture, KeyboardInputSimulationFixture, MouseInputSimulationFixture, StateVerificationFixture, WindowLikeContainerFixture
Direct Known Subclasses:
DialogFixture, FrameFixture

public abstract class WindowFixture<T extends Window>
extends ContainerFixture<T>
implements CommonComponentFixture, WindowLikeContainerFixture, JPopupMenuInvokerFixture

Understands functional testing of Windows:

Author:
Alex Ruiz

Field Summary
 
Fields inherited from class org.fest.swing.fixture.ComponentFixture
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
 
Fields inherited from interface org.fest.swing.fixture.ComponentContainerFixture
DEFAULT_DIALOG_LOOKUP_TIMEOUT
 
Constructor Summary
WindowFixture(Class<? extends T> type)
          Creates a new WindowFixture.
WindowFixture(Robot robot, Class<? extends T> type)
          Creates a new WindowFixture.
WindowFixture(Robot robot, String name, Class<? extends T> type)
          Creates a new WindowFixture.
WindowFixture(Robot robot, T target)
          Creates a new WindowFixture.
WindowFixture(String name, Class<? extends T> type)
          Creates a new WindowFixture.
WindowFixture(T target)
          Creates a new WindowFixture.
 
Method Summary
 void cleanUp()
          Cleans up any used resources (keyboard, mouse, open windows and ScreenLock) used by this robot.
protected abstract  WindowFixture<T> show()
          Shows this fixture's Window.
protected abstract  WindowFixture<T> show(Dimension size)
          Shows this fixture's Window, resized to the given size.
 
Methods inherited from class org.fest.swing.fixture.ContainerFixture
button, button, button, checkBox, checkBox, checkBox, comboBox, comboBox, comboBox, dialog, dialog, dialog, dialog, dialog, dialog, fileChooser, fileChooser, fileChooser, fileChooser, fileChooser, fileChooser, find, findByName, findByType, finder, label, label, label, list, list, list, menuItem, menuItem, menuItemWithPath, optionPane, optionPane, panel, panel, panel, progressBar, progressBar, progressBar, radioButton, radioButton, radioButton, scrollBar, scrollBar, scrollBar, scrollPane, scrollPane, scrollPane, slider, slider, slider, spinner, spinner, spinner, splitPane, splitPane, splitPane, tabbedPane, tabbedPane, tabbedPane, table, table, table, textBox, textBox, textBox, toggleButton, toggleButton, toggleButton, toolBar, toolBar, toolBar, tree, tree, tree, with
 
Methods inherited from class org.fest.swing.fixture.ComponentFixture
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.fest.swing.fixture.FocusableComponentFixture
focus, requireFocused
 
Methods inherited from interface org.fest.swing.fixture.KeyboardInputSimulationFixture
pressAndReleaseKey, pressAndReleaseKeys, pressKey, releaseKey
 
Methods inherited from interface org.fest.swing.fixture.MouseInputSimulationFixture
click, click, click, doubleClick, rightClick
 
Methods inherited from interface org.fest.swing.fixture.StateVerificationFixture
requireDisabled, requireEnabled, requireEnabled, requireNotVisible, requireVisible
 
Methods inherited from interface org.fest.swing.fixture.WindowLikeContainerFixture
close, moveTo, moveToBack, moveToFront, requireSize, resizeHeightTo, resizeTo, resizeWidthTo
 
Methods inherited from interface org.fest.swing.fixture.JPopupMenuInvokerFixture
showPopupMenu, showPopupMenuAt
 

Constructor Detail

WindowFixture

public WindowFixture(Class<? extends T> type)
Creates a new WindowFixture. This constructor creates a new Robot containing the current AWT hierarchy.

Parameters:
type - the type of Window to find using the created Robot.
Throws:
NullPointerException - if the given Window type is null.
ComponentLookupException - if a Window having a matching type could not be found.
ComponentLookupException - if more than one Window having a matching type is found.
See Also:
BasicRobot.robotWithCurrentAwtHierarchy()

WindowFixture

public WindowFixture(Robot robot,
                     Class<? extends T> type)
Creates a new WindowFixture.

Parameters:
robot - performs simulation of user events on a Window.
type - the type of Window to find using the given Robot.
Throws:
NullPointerException - if the given robot is null.
NullPointerException - if the given Window type is null.
ComponentLookupException - if a Window having a matching type could not be found.
ComponentLookupException - if more than one Window having a matching type is found.

WindowFixture

public WindowFixture(String name,
                     Class<? extends T> type)
Creates a new WindowFixture. This constructor creates a new Robot containing the current AWT hierarchy.

Parameters:
name - the name of the Window to find.
type - the type of Window to find using the created Robot.
Throws:
NullPointerException - if the given Window type is null.
ComponentLookupException - if a Window having a matching name could not be found.
ComponentLookupException - if more than one Window having a matching name is found.
See Also:
BasicRobot.robotWithCurrentAwtHierarchy()

WindowFixture

public WindowFixture(Robot robot,
                     String name,
                     Class<? extends T> type)
Creates a new WindowFixture.

Parameters:
robot - performs simulation of user events on a Window.
name - the name of the Window to find using the given Robot.
type - the type of Window to find using the given Robot.
Throws:
NullPointerException - if the given robot is null.
NullPointerException - if the given Window type is null.
ComponentLookupException - if a Window having a matching name could not be found.
ComponentLookupException - if more than one Window having a matching name is found.

WindowFixture

public WindowFixture(T target)
Creates a new WindowFixture. This constructor creates a new Robot containing the current AWT hierarchy.

Parameters:
target - the Window to be managed by this fixture.
Throws:
NullPointerException - if the given target Window is null.

WindowFixture

public WindowFixture(Robot robot,
                     T target)
Creates a new WindowFixture.

Parameters:
robot - performs simulation of user events on the given Window.
target - the Window to be managed by this fixture.
Throws:
NullPointerException - if the given robot is null.
NullPointerException - if the given target Window is null.
Method Detail

show

protected abstract WindowFixture<T> show()
Shows this fixture's Window.

Returns:
this fixture.

show

protected abstract WindowFixture<T> show(Dimension size)
Shows this fixture's Window, resized to the given size.

Parameters:
size - the size to resize this fixture's Window to.
Returns:
this fixture.

cleanUp

public final void cleanUp()
Cleans up any used resources (keyboard, mouse, open windows and ScreenLock) used by this robot.



Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.