public class JOptionPaneFixture extends AbstractContainerFixture<JOptionPaneFixture,JOptionPane,JOptionPaneDriver>
JOptionPane
s.BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY
Constructor and Description |
---|
JOptionPaneFixture(Robot robot)
Creates a new
JOptionPaneFixture . |
JOptionPaneFixture(Robot robot,
JOptionPane target)
Creates a new
JOptionPaneFixture . |
Modifier and Type | Method and Description |
---|---|
JButtonFixture |
buttonWithText(Pattern pattern)
Finds and returns a fixture wrapping a button (this fixture's
JOptionPane ) matching the given text. |
JButtonFixture |
buttonWithText(String text)
Finds and returns a fixture wrapping a button (this fixture's
JOptionPane ) matching the given text. |
JButtonFixture |
cancelButton()
Returns a fixture wrapping the "Cancel" button in this fixture's
JOptionPane . |
protected JOptionPaneDriver |
createDriver(Robot robot) |
JButtonFixture |
noButton()
Returns a fixture wrapping the "No" button in this fixture's
JOptionPane . |
JButtonFixture |
okButton()
Returns a fixture wrapping the "OK" button in this fixture's
JOptionPane . |
JOptionPaneFixture |
requireErrorMessage()
Asserts that this fixture's
JOptionPane is displaying an error message. |
JOptionPaneFixture |
requireInformationMessage()
Asserts that this fixture's
JOptionPane is displaying an information message. |
JOptionPaneFixture |
requireMessage(Object message)
Asserts that the message of this fixture's
JOptionPane matches the given value. |
JOptionPaneFixture |
requireMessage(Pattern pattern)
Asserts that the message of this fixture's
JOptionPane matches the given regular expression pattern. |
JOptionPaneFixture |
requireOptions(Object[] options)
Asserts that this fixture's
JOptionPane has the given options. |
JOptionPaneFixture |
requirePlainMessage()
Asserts that this fixture's
JOptionPane is displaying a plain message. |
JOptionPaneFixture |
requireQuestionMessage()
Asserts that this fixture's
JOptionPane is displaying a question. |
JOptionPaneFixture |
requireTitle(Pattern pattern)
Asserts that the title of this fixture's
JOptionPane matches the given regular expression pattern. |
JOptionPaneFixture |
requireTitle(String title)
Asserts that the title of this fixture's
JOptionPane matches the given value. |
JOptionPaneFixture |
requireWarningMessage()
Asserts that this fixture's
JOptionPane is displaying a warning message. |
String |
title() |
JButtonFixture |
yesButton()
Returns a fixture wrapping the "Yes" button in this fixture's
JOptionPane . |
button, button, button, checkBox, checkBox, checkBox, comboBox, comboBox, comboBox, defaultDialogLookupTimeout, dialog, dialog, dialog, dialog, dialog, dialog, fileChooser, fileChooser, fileChooser, fileChooser, fileChooser, fileChooser, find, findByName, findByType, finder, internalFrame, internalFrame, internalFrame, 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, click, click, click, doubleClick, driver, drop, equals, focus, font, foreground, hashCode, isEnabled, myself, pressAndReleaseKey, pressAndReleaseKeys, pressKey, pressKeyWhileRunning, releaseKey, replaceDriverWith, requireDisabled, requireEnabled, requireEnabled, requireFocused, requireNotVisible, requireShowing, requireVisible, rightClick, robot, target, targetCastedTo
public JOptionPaneFixture(@Nonnull 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(@Nonnull Robot robot, @Nonnull 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
.@Nonnull protected JOptionPaneDriver createDriver(@Nonnull Robot robot)
createDriver
in class AbstractComponentFixture<JOptionPaneFixture,JOptionPane,JOptionPaneDriver>
@Nonnull public JButtonFixture okButton()
JOptionPane
. This method is locale-independent
and platform-independent.ComponentLookupException
- if the a "OK" button cannot be found.@Nonnull public JButtonFixture cancelButton()
JOptionPane
. This method is
locale-independent and platform-independent.ComponentLookupException
- if the a "Cancel" button cannot be found.@Nonnull public JButtonFixture yesButton()
JOptionPane
. This method is
locale-independent and platform-independent.ComponentLookupException
- if the a "Yes" button cannot be found.@Nonnull public JButtonFixture noButton()
JOptionPane
. This method is locale-independent
and platform-independent.ComponentLookupException
- if the a "No" button cannot be found.@Nonnull public JButtonFixture buttonWithText(@Nullable 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.@Nonnull public JButtonFixture buttonWithText(@Nonnull 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.@Nonnull public JOptionPaneFixture requireErrorMessage()
JOptionPane
is displaying an error message.@Nonnull public JOptionPaneFixture requireInformationMessage()
JOptionPane
is displaying an information message.@Nonnull public JOptionPaneFixture requireWarningMessage()
JOptionPane
is displaying a warning message.@Nonnull public JOptionPaneFixture requireQuestionMessage()
JOptionPane
is displaying a question.@Nonnull public JOptionPaneFixture requirePlainMessage()
JOptionPane
is displaying a plain message.@Nonnull public JOptionPaneFixture requireTitle(@Nullable 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.@Nonnull public JOptionPaneFixture requireTitle(@Nonnull 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.@Nonnull public JOptionPaneFixture requireMessage(@Nullable 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.@Nonnull public JOptionPaneFixture requireMessage(@Nonnull 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.@Nonnull public JOptionPaneFixture requireOptions(@Nonnull Object[] options)
JOptionPane
has the given options.options
- the options to verify.AssertionError
- if this fixture's JOptionPaneFixture
does not have the given options.Copyright © 2014–2017 AssertJ. All rights reserved.