public class JOptionPaneFixture extends ContainerFixture<JOptionPane> implements CommonComponentFixture
JOptionPane
s:
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target
DEFAULT_DIALOG_LOOKUP_TIMEOUT
Constructor and Description |
---|
JOptionPaneFixture(Robot robot)
Creates a new
. |
JOptionPaneFixture(Robot robot,
JOptionPane target)
Creates a new
. |
Modifier and Type | Method and Description |
---|---|
JButtonFixture |
buttonWithText(Pattern pattern)
Finds and returns a fixture wrapping a button (this fixture's
) matching the
given text. |
JButtonFixture |
buttonWithText(String text)
Finds and returns a fixture wrapping a button (this fixture's
) matching the
given text. |
JButtonFixture |
cancelButton()
Returns a fixture wrapping the "Cancel" button in this fixture's
. |
JOptionPaneFixture |
click()
Simulates a user clicking this fixture's
. |
JOptionPaneFixture |
click(MouseButton button)
Simulates a user clicking this fixture's
. |
JOptionPaneFixture |
click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's
. |
JOptionPaneFixture |
doubleClick()
Simulates a user double-clicking this fixture's
. |
protected void |
driver(JOptionPaneDriver newDriver)
Sets the
to be used by this fixture. |
JOptionPaneFixture |
focus()
Gives input focus to this fixture's
. |
JButtonFixture |
noButton()
Returns a fixture wrapping the "No" button in this fixture's
. |
JButtonFixture |
okButton()
Returns a fixture wrapping the "OK" button in this fixture's
. |
JOptionPaneFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's
. |
JOptionPaneFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys this fixture's
. |
JOptionPaneFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's
. |
JOptionPaneFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's
. |
JOptionPaneFixture |
requireDisabled()
Asserts that this fixture's
is disabled. |
JOptionPaneFixture |
requireEnabled()
Asserts that this fixture's
is enabled. |
JOptionPaneFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's
is enabled. |
JOptionPaneFixture |
requireErrorMessage()
Asserts that this fixture's
is displaying an error message. |
JOptionPaneFixture |
requireFocused()
Asserts that this fixture's
has input focus. |
JOptionPaneFixture |
requireInformationMessage()
Asserts that this fixture's
is displaying an information
message. |
JOptionPaneFixture |
requireMessage(Object message)
Asserts that the message of this fixture's
matches the given value. |
JOptionPaneFixture |
requireMessage(Pattern pattern)
Asserts that the message of this fixture's
matches the given regular expression
pattern. |
JOptionPaneFixture |
requireNotVisible()
Asserts that this fixture's
is not visible. |
JOptionPaneFixture |
requireOptions(Object[] options)
Asserts that this fixture's
has the given options. |
JOptionPaneFixture |
requirePlainMessage()
Asserts that this fixture's
is displaying a plain message. |
JOptionPaneFixture |
requireQuestionMessage()
Asserts that this fixture's
is displaying a question. |
JOptionPaneFixture |
requireTitle(Pattern pattern)
Asserts that the title of this fixture's
matches the given regular expression
pattern. |
JOptionPaneFixture |
requireTitle(String title)
Asserts that the title of this fixture's
matches the given value. |
JOptionPaneFixture |
requireVisible()
Asserts that this fixture's
is visible. |
JOptionPaneFixture |
requireWarningMessage()
Asserts that this fixture's
is displaying a warning message. |
JOptionPaneFixture |
rightClick()
Simulates a user right-clicking this fixture's
. |
String |
title()
Returns the title of this fixture's
. |
JButtonFixture |
yesButton()
Returns a fixture wrapping the "Yes" button in this fixture's
. |
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
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull
public JOptionPaneFixture(Robot robot)
JOptionPaneFixture
.robot
- finds a showing JOptionPane
, which will be managed by this fixture.NullPointerException
- if robot
is null
.ComponentLookupException
- if a showing JOptionPane
could not be found.ComponentLookupException
- if more than one showing JOptionPane
is found.public JOptionPaneFixture(Robot robot, JOptionPane target)
JOptionPaneFixture
.robot
- performs simulation of user events on the given JOptionPane
.target
- the JOptionPane
to be managed by this fixture.NullPointerException
- if robot
is null
.IllegalArgumentException
- if target
is null
.protected final void driver(JOptionPaneDriver newDriver)
JOptionPaneDriver
to be used by this fixture.newDriver
- the new JOptionPaneDriver
.NullPointerException
- if the given driver is null
.public String title()
JOptionPane
.JOptionPane
.public JButtonFixture okButton()
JOptionPane
. This method is
locale-independent and platform-independent.ComponentLookupException
- if the a "OK" button cannot be found.public JButtonFixture cancelButton()
JOptionPane
. This method is
locale-independent and platform-independent.ComponentLookupException
- if the a "Cancel" button cannot be found.public JButtonFixture yesButton()
JOptionPane
. This method is
locale-independent and platform-independent.ComponentLookupException
- if the a "Yes" button cannot be found.public JButtonFixture noButton()
JOptionPane
. This method is
locale-independent and platform-independent.ComponentLookupException
- if the a "No" button cannot be found.public JButtonFixture buttonWithText(String text)
JOptionPane
) matching the
given text.text
- the text of the button to find. It can be a regular expression.ComponentLookupException
- if the a button with the given text cannot be found.public JButtonFixture buttonWithText(Pattern pattern)
JOptionPane
) matching the
given text.pattern
- the regular expression pattern to match.NullPointerException
- if the given regular expression pattern is null
.ComponentLookupException
- if the a button with the given text cannot be found.public JOptionPaneFixture click()
JOptionPane
.click
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JOptionPane
is disabled.IllegalStateException
- if this fixture's JOptionPane
is not showing on the screen.public JOptionPaneFixture click(MouseButton button)
JOptionPane
.click
in interface MouseInputSimulationFixture
button
- the button to click.NullPointerException
- if the given MouseButton
is null
.IllegalStateException
- if this fixture's JOptionPane
is disabled.IllegalStateException
- if this fixture's JOptionPane
is not showing on the screen.public JOptionPaneFixture click(MouseClickInfo mouseClickInfo)
JOptionPane
.click
in interface MouseInputSimulationFixture
mouseClickInfo
- specifies the button to click and the times the button should be clicked.NullPointerException
- if the given MouseClickInfo
is null
.IllegalStateException
- if this fixture's JOptionPane
is disabled.IllegalStateException
- if this fixture's JOptionPane
is not showing on the screen.public JOptionPaneFixture rightClick()
JOptionPane
.rightClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JOptionPane
is disabled.IllegalStateException
- if this fixture's JOptionPane
is not showing on the screen.public JOptionPaneFixture doubleClick()
JOptionPane
.doubleClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JOptionPane
is disabled.IllegalStateException
- if this fixture's JOptionPane
is not showing on the screen.public JOptionPaneFixture focus()
JOptionPane
.focus
in interface FocusableComponentFixture
IllegalStateException
- if this fixture's JOptionPane
is disabled.IllegalStateException
- if this fixture's JOptionPane
is not showing on the screen.public JOptionPaneFixture requireErrorMessage()
JOptionPane
is displaying an error message.public JOptionPaneFixture requireInformationMessage()
JOptionPane
is displaying an information
message.public JOptionPaneFixture requireWarningMessage()
JOptionPane
is displaying a warning message.public JOptionPaneFixture requireQuestionMessage()
JOptionPane
is displaying a question.public JOptionPaneFixture requirePlainMessage()
JOptionPane
is displaying a plain message.public JOptionPaneFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JOptionPane
.
Modifiers is a mask from the available InputEvent
masks.pressAndReleaseKey
in interface KeyboardInputSimulationFixture
keyPressInfo
- specifies the key and modifiers to press.NullPointerException
- if the given KeyPressInfo
is null
.IllegalArgumentException
- if the given code is not a valid key code.KeyPressInfo
public JOptionPaneFixture pressAndReleaseKeys(int... keyCodes)
JOptionPane
. This method
does not affect the current focus.pressAndReleaseKeys
in interface KeyboardInputSimulationFixture
keyCodes
- one or more codes of the keys to press.NullPointerException
- if the given array of codes is null
.IllegalArgumentException
- if any of the given code is not a valid key code.KeyEvent
public JOptionPaneFixture pressKey(int keyCode)
JOptionPane
.pressKey
in interface KeyboardInputSimulationFixture
keyCode
- the code of the key to press.IllegalArgumentException
- if any of the given code is not a valid key code.KeyEvent
public JOptionPaneFixture releaseKey(int keyCode)
JOptionPane
.releaseKey
in interface KeyboardInputSimulationFixture
keyCode
- the code of the key to release.IllegalArgumentException
- if any of the given code is not a valid key code.KeyEvent
public JOptionPaneFixture requireTitle(String title)
JOptionPane
matches the given value.title
- the title to match. It can be a regular expression.AssertionError
- if this fixture's JOptionPaneFixture does not have the given title.public JOptionPaneFixture requireTitle(Pattern pattern)
JOptionPane
matches the given regular expression
pattern.pattern
- the regular expression pattern to match.NullPointerException
- if the given regular expression is null
.AssertionError
- if this fixture's JOptionPaneFixture does not have the given title.public JOptionPaneFixture requireMessage(Object message)
JOptionPane
matches the given value.message
- the message to verify. If it is a String
, it can be specified as a regular expression.AssertionError
- if the message in this fixture's JOptionPaneFixture is not equal to or does
not match the given message.public JOptionPaneFixture requireMessage(Pattern pattern)
JOptionPane
matches the given regular expression
pattern. If the message in the JOptionPane
is not a String
, this method will use the
toString
representation of such message.pattern
- the regular expression to match.NullPointerException
- if the given regular expression pattern is null
.AssertionError
- if the message in this fixture's JOptionPaneFixture does not match the given
regular expression pattern.public JOptionPaneFixture requireOptions(Object[] options)
JOptionPane
has the given options.options
- the options to verify.AssertionError
- if this fixture's JOptionPaneFixture does not have the given options.public JOptionPaneFixture requireFocused()
JOptionPane
has input focus.requireFocused
in interface FocusableComponentFixture
AssertionError
- if this fixture's JOptionPane
does not have input focus.public JOptionPaneFixture requireEnabled()
JOptionPane
is enabled.requireEnabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JOptionPane
is disabled.public JOptionPaneFixture requireEnabled(Timeout timeout)
JOptionPane
is enabled.requireEnabled
in interface StateVerificationFixture
timeout
- the time this fixture will wait for the component to be enabled.WaitTimedOutError
- if this fixture's JOptionPane
is never enabled.public JOptionPaneFixture requireDisabled()
JOptionPane
is disabled.requireDisabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JOptionPane
is enabled.public JOptionPaneFixture requireVisible()
JOptionPane
is visible.requireVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JOptionPane
is not visible.public JOptionPaneFixture requireNotVisible()
JOptionPane
is not visible.requireNotVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JOptionPane
is visible.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.