public class JOptionPaneDriver extends JComponentDriver
JOptionPane
s:
org.fest.swing.fixture
in your tests.robot
Constructor and Description |
---|
JOptionPaneDriver(Robot robot)
Creates a new
JOptionPaneDriver . |
Modifier and Type | Method and Description |
---|---|
JButton |
button(JOptionPane optionPane)
Deprecated.
in 1.2
|
JButton |
buttonWithText(JOptionPane optionPane,
Pattern pattern)
Finds a button in the
whose text matches the given regular expression pattern. |
JButton |
buttonWithText(JOptionPane optionPane,
String text)
Finds a button in the
containing the given text. |
JButton |
cancelButton(JOptionPane optionPane)
Finds the "Cancel" button in the
. |
JButton |
noButton(JOptionPane optionPane)
Finds the "No" button in the
. |
JButton |
okButton(JOptionPane optionPane)
Finds the "OK" button in the
. |
void |
requireErrorMessage(JOptionPane optionPane)
Asserts that the
is displaying an error message. |
void |
requireInformationMessage(JOptionPane optionPane)
Asserts that the
is displaying an information message. |
void |
requireMessage(JOptionPane optionPane,
Object message)
Asserts that the title of the
matches the given value. |
void |
requireMessage(JOptionPane optionPane,
Pattern pattern)
Asserts that the title of the
matches the given regular expression pattern. |
void |
requireOptions(JOptionPane optionPane,
Object[] options)
Asserts that the
has the given options. |
void |
requirePlainMessage(JOptionPane optionPane)
Asserts that the
is displaying a plain message. |
void |
requireQuestionMessage(JOptionPane optionPane)
Asserts that the
is displaying a question. |
void |
requireTitle(JOptionPane optionPane,
Pattern pattern)
Asserts that the title in the given
matches the given regular expression pattern. |
void |
requireTitle(JOptionPane optionPane,
String title)
Asserts that the title in the given
matches the given value. |
void |
requireWarningMessage(JOptionPane optionPane)
Asserts that the
is displaying a warning message. |
JTextComponent |
textBox(JOptionPane optionPane)
Deprecated.
in 1.2
|
String |
title(JOptionPane optionPane)
Returns the title of the given
. |
JButton |
yesButton(JOptionPane optionPane)
Finds the "Yes" button in the
. |
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisible
move, resize, resizeHeight, resizeWidth
assertIsEnabledAndShowing, click, click, click, click, click, doubleClick, drag, dragOver, drop, focus, focusAndWaitForFocusGain, invokePopupMenu, invokePopupMenu, moveMouseIgnoringAnyError, moveMouseIgnoringAnyError, performAccessibleActionOf, pressAndReleaseKey, pressAndReleaseKey, pressAndReleaseKeys, pressKey, propertyName, releaseKey, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireSize, requireVisible, rightClick, settings, waitForShowing
public JOptionPaneDriver(Robot robot)
JOptionPaneDriver
.robot
- the robot to use to simulate user input.@RunsInEDT public void requireTitle(JOptionPane optionPane, String title)
JOptionPane
matches the given value.optionPane
- the target JOptionPane
.title
- the title to match. It can be a regular expression.AssertionError
- if the JOptionPane
does not have the given title.@RunsInEDT public void requireTitle(JOptionPane optionPane, Pattern pattern)
JOptionPane
matches the given regular expression pattern.optionPane
- the target JOptionPane
.pattern
- the regular expression pattern to match.NullPointerException
- if the given regular expression pattern is null
.AssertionError
- if the JOptionPane
does not have the given title.@RunsInEDT public String title(JOptionPane optionPane)
JOptionPane
.optionPane
- the target JOptionPane
.JOptionPane
.@RunsInEDT public void requireMessage(JOptionPane optionPane, Object message)
JOptionPane
matches the given value. If the given value is a
regular expression and the message in the JOptionPane
is not a String
, this method will use the
toString
representation of such message.
message in the JOptionPane
is not a String
, this method will use the
toString
representation of such message.optionPane
- the target JOptionPane
.message
- the message to verify. If it is a String
, it can be specified as a regular expression.AssertionError
- if the message in the JOptionPane
is not equal to or does not match the given
message.@RunsInEDT public void requireMessage(JOptionPane optionPane, 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.optionPane
- the target JOptionPane
.pattern
- the regular expression to match.NullPointerException
- if the given regular expression pattern is null
.AssertionError
- if the message in the JOptionPaneFixture does not match the given regular
expression pattern.@RunsInEDT public void requireOptions(JOptionPane optionPane, Object[] options)
JOptionPane
has the given options.optionPane
- the target JOptionPane
.options
- the options to verify.AssertionError
- if the JOptionPane
does not have the given options.@RunsInEDT public JButton okButton(JOptionPane optionPane)
JOptionPane
. This method is independent of locale and platform.optionPane
- the target JOptionPane
.ComponentLookupException
- if the a "OK" button cannot be found.@RunsInEDT public JButton cancelButton(JOptionPane optionPane)
JOptionPane
. This method is independent of locale and
platform.optionPane
- the target JOptionPane
.ComponentLookupException
- if the a "Cancel" button cannot be found.@RunsInEDT public JButton yesButton(JOptionPane optionPane)
JOptionPane
. This method is independent of locale and platform.optionPane
- the target JOptionPane
.ComponentLookupException
- if the a "Yes" button cannot be found.@RunsInEDT public JButton noButton(JOptionPane optionPane)
JOptionPane
. This method is independent of locale and platform.optionPane
- the target JOptionPane
.ComponentLookupException
- if the a "No" button cannot be found.@RunsInEDT public JButton buttonWithText(JOptionPane optionPane, String text)
JOptionPane
containing the given text.optionPane
- the target JOptionPane
.text
- the text of the button to find and return. It can be a regular expression.ComponentLookupException
- if the a button with the given text cannot be found.@RunsInEDT public JButton buttonWithText(JOptionPane optionPane, Pattern pattern)
JOptionPane
whose text matches the given regular expression pattern.optionPane
- the target JOptionPane
.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.@RunsInEDT @Deprecated public JButton button(JOptionPane optionPane)
JButton
in the JOptionPane
(assuming it has only one button.)optionPane
- the target JOptionPane
.JButton
contained in the JOptionPane
.ComponentLookupException
- if a matching component could not be found.ComponentLookupException
- if more than one matching component is found.@RunsInEDT @Deprecated public JTextComponent textBox(JOptionPane optionPane)
JTextComponent
in the given message only if the message is of type input.optionPane
- the target JOptionPane
.ComponentLookupException
- if the message type is not input and therefore it does not contain a text component.@RunsInEDT public void requireErrorMessage(JOptionPane optionPane)
JOptionPane
is displaying an error message.optionPane
- the target JOptionPane
.@RunsInEDT public void requireInformationMessage(JOptionPane optionPane)
JOptionPane
is displaying an information message.optionPane
- the target JOptionPane
.@RunsInEDT public void requireWarningMessage(JOptionPane optionPane)
JOptionPane
is displaying a warning message.optionPane
- the target JOptionPane
.@RunsInEDT public void requireQuestionMessage(JOptionPane optionPane)
JOptionPane
is displaying a question.optionPane
- the target JOptionPane
.@RunsInEDT public void requirePlainMessage(JOptionPane optionPane)
JOptionPane
is displaying a plain message.optionPane
- the target JOptionPane
.Copyright © 2007-2013 FEST (Fixtures for Easy Software Testing). All Rights Reserved.