org.fest.swing.fixture
Class JInternalFrameFixture

java.lang.Object
  extended by org.fest.swing.fixture.ComponentFixture<T>
      extended by org.fest.swing.fixture.ContainerFixture<JInternalFrame>
          extended by org.fest.swing.fixture.JInternalFrameFixture
All Implemented Interfaces:
ClientPropertyStorageFixture, CommonComponentFixture, ComponentContainerFixture, FocusableComponentFixture, FrameLikeFixture, JComponentFixture, JPopupMenuInvokerFixture, KeyboardInputSimulationFixture, MouseInputSimulationFixture, StateVerificationFixture, ToolTipDisplayFixture, WindowLikeContainerFixture

public class JInternalFrameFixture
extends ContainerFixture<JInternalFrame>
implements CommonComponentFixture, FrameLikeFixture, JComponentFixture, JPopupMenuInvokerFixture

Understands functional testing of JInternalFrames:

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
JInternalFrameFixture(Robot robot, JInternalFrame target)
          Creates a new JInternalFrameFixture.
JInternalFrameFixture(Robot robot, String internalFrameName)
          Creates a new JInternalFrameFixture.
 
Method Summary
 JInternalFrameFixture click()
          Simulates a user clicking this fixture's JInternalFrame.
 JInternalFrameFixture click(MouseButton button)
          Simulates a user clicking this fixture's JInternalFrame.
 JInternalFrameFixture click(MouseClickInfo mouseClickInfo)
          Simulates a user clicking this fixture's JInternalFrame.
 Object clientProperty(Object key)
          Returns the client property stored in this fixture's JInternalFrame, under the given key.
 void close()
          Simulates a user closing this fixture's JInternalFrame.
 JInternalFrameFixture deiconify()
          Simulates a user deiconifying this fixture's JInternalFrame.
 JInternalFrameFixture doubleClick()
          Simulates a user double-clicking this fixture's JInternalFrame.
protected  void driver(JInternalFrameDriver newDriver)
          Sets the JInternalFrameDriver to be used by this fixture.
 JInternalFrameFixture focus()
          Gives input focus to this fixture's JInternalFrame.
 JInternalFrameFixture iconify()
          Simulates a user iconifying this fixture's JInternalFrame.
 JInternalFrameFixture maximize()
          Simulates a user maximizing this fixture's JInternalFrame, deconifying it first if it is iconified.
 JInternalFrameFixture moveTo(Point p)
          Simulates a user moving this fixture's JInternalFrame to the given point.
 JInternalFrameFixture moveToBack()
          Brings this fixture's JInternalFrame to the back.
 JInternalFrameFixture moveToFront()
          Brings this fixture's JInternalFrame to the front.
 JInternalFrameFixture normalize()
          Simulates a user normalizing this fixture's JInternalFrame, deconifying it first if it is iconified.
 JInternalFrameFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
          Simulates a user pressing given key with the given modifiers on this fixture's JInternalFrame.
 JInternalFrameFixture pressAndReleaseKeys(int... keyCodes)
          Simulates a user pressing and releasing the given keys on this fixture's JInternalFrame .
 JInternalFrameFixture pressKey(int keyCode)
          Simulates a user pressing given key on this fixture's JInternalFrame.
 JInternalFrameFixture releaseKey(int keyCode)
          Simulates a user releasing the given key on this fixture's JInternalFrame.
 JInternalFrameFixture requireDisabled()
          Asserts that this fixture's JInternalFrame is disabled.
 JInternalFrameFixture requireEnabled()
          Asserts that this fixture's JInternalFrame is enabled.
 JInternalFrameFixture requireEnabled(Timeout timeout)
          Asserts that this fixture's JInternalFrame is enabled.
 JInternalFrameFixture requireFocused()
          Asserts that this fixture's JInternalFrame has input focus.
 JInternalFrameFixture requireNotVisible()
          Asserts that this fixture's JInternalFrame is not visible.
 JInternalFrameFixture requireSize(Dimension size)
          Asserts that the size of this fixture's JInternalFrame is equal to given one.
 JInternalFrameFixture requireToolTip(Pattern pattern)
          Asserts that the toolTip in this fixture's JInternalFrame matches the given regular expression pattern.
 JInternalFrameFixture requireToolTip(String expected)
          Asserts that the toolTip in this fixture's JInternalFrame matches the given value.
 JInternalFrameFixture requireVisible()
          Asserts that this fixture's JInternalFrame is visible.
 JInternalFrameFixture resizeHeightTo(int height)
          Simulates a user resizing vertically this fixture's JInternalFrame.
 JInternalFrameFixture resizeTo(Dimension size)
          Simulates a user resizing this fixture's JInternalFrame.
 JInternalFrameFixture resizeWidthTo(int width)
          Simulates a user resizing horizontally this fixture's JInternalFrame.
 JInternalFrameFixture rightClick()
          Simulates a user right-clicking this fixture's JInternalFrame.
 JPopupMenuFixture showPopupMenu()
          Shows a pop-up menu using this fixture's JInternalFrame as the invoker of the pop-up menu.
 JPopupMenuFixture showPopupMenuAt(Point p)
          Shows a pop-up menu at the given point using this fixture's JInternalFrame as the invoker of the pop-up menu.
 
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
 

Constructor Detail

JInternalFrameFixture

public JInternalFrameFixture(Robot robot,
                             String internalFrameName)
Creates a new JInternalFrameFixture.

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

JInternalFrameFixture

public JInternalFrameFixture(Robot robot,
                             JInternalFrame target)
Creates a new JInternalFrameFixture.

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

driver

protected final void driver(JInternalFrameDriver newDriver)
Sets the JInternalFrameDriver to be used by this fixture.

Parameters:
newDriver - the new JInternalFrameDriver.
Throws:
NullPointerException - if the given driver is null.

moveToFront

public JInternalFrameFixture moveToFront()
Brings this fixture's JInternalFrame to the front.

Specified by:
moveToFront in interface WindowLikeContainerFixture
Returns:
this fixture.

moveToBack

public JInternalFrameFixture moveToBack()
Brings this fixture's JInternalFrame to the back.

Specified by:
moveToBack in interface WindowLikeContainerFixture
Returns:
this fixture.

deiconify

public JInternalFrameFixture deiconify()
Simulates a user deiconifying this fixture's JInternalFrame.

Specified by:
deiconify in interface FrameLikeFixture
Returns:
this fixture.
Throws:
ActionFailedException - if the JInternalFrame vetoes the action.

iconify

public JInternalFrameFixture iconify()
Simulates a user iconifying this fixture's JInternalFrame.

Specified by:
iconify in interface FrameLikeFixture
Returns:
this fixture.
Throws:
ActionFailedException - if the given JInternalFrame is not iconifiable.
ActionFailedException - if the JInternalFrame vetoes the action.

maximize

public JInternalFrameFixture maximize()
Simulates a user maximizing this fixture's JInternalFrame, deconifying it first if it is iconified.

Specified by:
maximize in interface FrameLikeFixture
Returns:
this fixture.
Throws:
ActionFailedException - if the given JInternalFrame is not maximizable.
ActionFailedException - if the JInternalFrame vetoes the action.

normalize

public JInternalFrameFixture normalize()
Simulates a user normalizing this fixture's JInternalFrame, deconifying it first if it is iconified.

Specified by:
normalize in interface FrameLikeFixture
Returns:
this fixture.
Throws:
ActionFailedException - if the JInternalFrame vetoes the action.

close

public void close()
Simulates a user closing this fixture's JInternalFrame.

Specified by:
close in interface WindowLikeContainerFixture
Throws:
ActionFailedException - if the JInternalFrame is not closable.

requireSize

public JInternalFrameFixture requireSize(Dimension size)
Asserts that the size of this fixture's JInternalFrame is equal to given one.

Specified by:
requireSize in interface WindowLikeContainerFixture
Parameters:
size - the given size to match.
Returns:
this fixture.
Throws:
AssertionError - if the size of this fixture's JInternalFrame is not equal to the given size.

resizeWidthTo

public JInternalFrameFixture resizeWidthTo(int width)
Simulates a user resizing horizontally this fixture's JInternalFrame.

Specified by:
resizeWidthTo in interface WindowLikeContainerFixture
Parameters:
width - the width that this fixture's JInternalFrame should have after being resized.
Returns:
this fixture.

resizeHeightTo

public JInternalFrameFixture resizeHeightTo(int height)
Simulates a user resizing vertically this fixture's JInternalFrame.

Specified by:
resizeHeightTo in interface WindowLikeContainerFixture
Parameters:
height - the height that this fixture's JInternalFrame should have after being resized.
Returns:
this fixture.

resizeTo

public JInternalFrameFixture resizeTo(Dimension size)
Simulates a user resizing this fixture's JInternalFrame.

Specified by:
resizeTo in interface WindowLikeContainerFixture
Parameters:
size - the size that the target JInternalFrame should have after being resized.
Returns:
this fixture.

moveTo

public JInternalFrameFixture moveTo(Point p)
Simulates a user moving this fixture's JInternalFrame to the given point.

Specified by:
moveTo in interface WindowLikeContainerFixture
Parameters:
p - the point to move this fixture's JInternalFrame to.
Returns:
this fixture.

click

public JInternalFrameFixture click()
Simulates a user clicking this fixture's JInternalFrame.

Specified by:
click in interface MouseInputSimulationFixture
Returns:
this fixture.

click

public JInternalFrameFixture click(MouseButton button)
Simulates a user clicking this fixture's JInternalFrame.

Specified by:
click in interface MouseInputSimulationFixture
Parameters:
button - the button to click.
Returns:
this fixture.

click

public JInternalFrameFixture click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's JInternalFrame.

Specified by:
click in interface MouseInputSimulationFixture
Parameters:
mouseClickInfo - specifies the button to click and the times the button should be clicked.
Returns:
this fixture.
Throws:
NullPointerException - if the given MouseClickInfo is null.

rightClick

public JInternalFrameFixture rightClick()
Simulates a user right-clicking this fixture's JInternalFrame.

Specified by:
rightClick in interface MouseInputSimulationFixture
Returns:
this fixture.

doubleClick

public JInternalFrameFixture doubleClick()
Simulates a user double-clicking this fixture's JInternalFrame.

Specified by:
doubleClick in interface MouseInputSimulationFixture
Returns:
this fixture.

focus

public JInternalFrameFixture focus()
Gives input focus to this fixture's JInternalFrame.

Specified by:
focus in interface FocusableComponentFixture
Returns:
this fixture.

pressAndReleaseKey

public JInternalFrameFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's JInternalFrame. Modifiers is a mask from the available InputEvent masks.

Specified by:
pressAndReleaseKey in interface KeyboardInputSimulationFixture
Parameters:
keyPressInfo - specifies the key and modifiers to press.
Returns:
this fixture.
Throws:
NullPointerException - if the given KeyPressInfo is null.
IllegalArgumentException - if the given code is not a valid key code.
See Also:
KeyPressInfo

pressAndReleaseKeys

public JInternalFrameFixture pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's JInternalFrame .

Specified by:
pressAndReleaseKeys in interface KeyboardInputSimulationFixture
Parameters:
keyCodes - one or more codes of the keys to press.
Returns:
this fixture.
Throws:
NullPointerException - if the given array of codes is null.
IllegalArgumentException - if any of the given code is not a valid key code.
See Also:
KeyEvent

pressKey

public JInternalFrameFixture pressKey(int keyCode)
Simulates a user pressing given key on this fixture's JInternalFrame.

Specified by:
pressKey in interface KeyboardInputSimulationFixture
Parameters:
keyCode - the code of the key to press.
Returns:
this fixture.
Throws:
IllegalArgumentException - if any of the given code is not a valid key code.
See Also:
KeyEvent

releaseKey

public JInternalFrameFixture releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's JInternalFrame.

Specified by:
releaseKey in interface KeyboardInputSimulationFixture
Parameters:
keyCode - the code of the key to release.
Returns:
this fixture.
Throws:
IllegalArgumentException - if any of the given code is not a valid key code.
See Also:
KeyEvent

requireFocused

public JInternalFrameFixture requireFocused()
Asserts that this fixture's JInternalFrame has input focus.

Specified by:
requireFocused in interface FocusableComponentFixture
Returns:
this fixture.
Throws:
AssertionError - if this fixture's JInternalFrame does not have input focus.

requireEnabled

public JInternalFrameFixture requireEnabled()
Asserts that this fixture's JInternalFrame is enabled.

Specified by:
requireEnabled in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if the managed JInternalFrame is disabled.

requireEnabled

public JInternalFrameFixture requireEnabled(Timeout timeout)
Asserts that this fixture's JInternalFrame is enabled.

Specified by:
requireEnabled in interface StateVerificationFixture
Parameters:
timeout - the time this fixture will wait for the component to be enabled.
Returns:
this fixture.
Throws:
WaitTimedOutError - if the managed JInternalFrame is never enabled.

requireDisabled

public JInternalFrameFixture requireDisabled()
Asserts that this fixture's JInternalFrame is disabled.

Specified by:
requireDisabled in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if the managed JInternalFrame is enabled.

requireVisible

public JInternalFrameFixture requireVisible()
Asserts that this fixture's JInternalFrame is visible.

Specified by:
requireVisible in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if the managed JInternalFrame is not visible.

requireNotVisible

public JInternalFrameFixture requireNotVisible()
Asserts that this fixture's JInternalFrame is not visible.

Specified by:
requireNotVisible in interface StateVerificationFixture
Returns:
this fixture.
Throws:
AssertionError - if the managed JInternalFrame is visible.

requireToolTip

public JInternalFrameFixture requireToolTip(String expected)
Asserts that the toolTip in this fixture's JInternalFrame matches the given value.

Specified by:
requireToolTip in interface ToolTipDisplayFixture
Parameters:
expected - the given value. It can be a regular expression.
Returns:
this fixture.
Throws:
AssertionError - if the toolTip in this fixture's JInternalFrame does not match the given value.
Since:
1.2

requireToolTip

public JInternalFrameFixture requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's JInternalFrame matches the given regular expression pattern.

Specified by:
requireToolTip in interface ToolTipDisplayFixture
Parameters:
pattern - the regular expression pattern to match.
Returns:
this fixture.
Throws:
NullPointerException - if the given regular expression pattern is null.
AssertionError - if the toolTip in this fixture's JInternalFrame does not match the given regular expression.
Since:
1.2

clientProperty

public Object clientProperty(Object key)
Returns the client property stored in this fixture's JInternalFrame, under the given key.

Specified by:
clientProperty in interface ClientPropertyStorageFixture
Parameters:
key - the key to use to retrieve the client property.
Returns:
the value of the client property stored under the given key, or null if the property was not found.
Throws:
NullPointerException - if the given key is null.
Since:
1.2

showPopupMenu

public JPopupMenuFixture showPopupMenu()
Shows a pop-up menu using this fixture's JInternalFrame as the invoker of the pop-up menu.

Specified by:
showPopupMenu in interface JPopupMenuInvokerFixture
Returns:
a fixture that manages the displayed pop-up menu.
Throws:
IllegalStateException - if this fixture's JInternalFrame is disabled.
IllegalStateException - if this fixture's JInternalFrame is not showing on the screen.
ComponentLookupException - if a pop-up menu cannot be found.

showPopupMenuAt

public JPopupMenuFixture showPopupMenuAt(Point p)
Shows a pop-up menu at the given point using this fixture's JInternalFrame as the invoker of the pop-up menu.

Specified by:
showPopupMenuAt in interface JPopupMenuInvokerFixture
Parameters:
p - the given point where to show the pop-up menu.
Returns:
a fixture that manages the displayed pop-up menu.
Throws:
IllegalStateException - if this fixture's JInternalFrame is disabled.
IllegalStateException - if this fixture's JInternalFrame is not showing on the screen.
ComponentLookupException - if a pop-up menu cannot be found.


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