public class JButtonFixture extends ComponentFixture<JButton> implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture, TextDisplayFixture
JButtons:
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target| Constructor and Description |
|---|
JButtonFixture(Robot robot,
JButton target)
Creates a new
. |
JButtonFixture(Robot robot,
String buttonName)
Creates a new
. |
| Modifier and Type | Method and Description |
|---|---|
JButtonFixture |
click()
Simulates a user clicking this fixture's
. |
JButtonFixture |
click(MouseButton button)
Simulates a user clicking this fixture's
. |
JButtonFixture |
click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's
. |
Object |
clientProperty(Object key)
Returns the client property stored in this fixture's
, under the given key. |
JButtonFixture |
doubleClick()
Simulates a user double-clicking this fixture's
. |
protected void |
driver(AbstractButtonDriver newDriver)
Sets the
to be used by this fixture. |
JButtonFixture |
focus()
Gives input focus to this fixture's
. |
JButtonFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's
. |
JButtonFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's
. |
JButtonFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's
. |
JButtonFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's
. |
JButtonFixture |
requireDisabled()
Asserts that this fixture's
is disabled. |
JButtonFixture |
requireEnabled()
Asserts that this fixture's
is enabled. |
JButtonFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's
is enabled. |
JButtonFixture |
requireFocused()
Asserts that this fixture's
has input focus. |
JButtonFixture |
requireNotVisible()
Asserts that this fixture's
is not visible. |
JButtonFixture |
requireText(Pattern pattern)
Asserts that the text of this fixture's
matches the given regular expression pattern. |
JButtonFixture |
requireText(String expected)
Asserts that the text of this fixture's
matches the specified value. |
JButtonFixture |
requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's
matches the given regular expression
pattern. |
JButtonFixture |
requireToolTip(String expected)
Asserts that the toolTip in this fixture's
matches the given value. |
JButtonFixture |
requireVisible()
Asserts that this fixture's
is visible. |
JButtonFixture |
rightClick()
Simulates a user right-clicking this fixture's
. |
JPopupMenuFixture |
showPopupMenu()
Shows a pop-up menu using this fixture's
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
as the invoker of the
pop-up menu. |
String |
text()
Returns the text of this fixture's
. |
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNullpublic JButtonFixture(Robot robot, JButton target)
JButtonFixture.target - the JButton to be managed by this fixture.robot - performs simulation of user events on the given JButton.NullPointerException - if robot is null.NullPointerException - if target is null.public JButtonFixture(Robot robot, String buttonName)
JButtonFixture.robot - performs simulation of user events on a JButton.buttonName - the name of the JButton to find using the given RobotFixture.NullPointerException - if robot is null.ComponentLookupException - if a matching JButton could not be found.ComponentLookupException - if more than one matching JButton is found.protected final void driver(AbstractButtonDriver newDriver)
AbstractButtonDriver to be used by this fixture.newDriver - the new AbstractButtonDriver.NullPointerException - if the given driver is null.public String text()
JButton.text in interface TextDisplayFixtureJButton.public JButtonFixture click()
JButton.click in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JButton is disabled.IllegalStateException - if this fixture's JButton is not showing on the screen.public JButtonFixture click(MouseButton button)
JButton.click in interface MouseInputSimulationFixturebutton - the button to click.NullPointerException - if the given MouseButton is null.IllegalStateException - if this fixture's JButton is disabled.IllegalStateException - if this fixture's JButton is not showing on the screen.public JButtonFixture click(MouseClickInfo mouseClickInfo)
JButton.click in interface MouseInputSimulationFixturemouseClickInfo - 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 JButton is disabled.IllegalStateException - if this fixture's JButton is not showing on the screen.public JButtonFixture doubleClick()
JButton.doubleClick in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JButton is disabled.IllegalStateException - if this fixture's JButton is not showing on the screen.public JButtonFixture rightClick()
JButton.rightClick in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JButton is disabled.IllegalStateException - if this fixture's JButton is not showing on the screen.public JButtonFixture focus()
JButton.focus in interface FocusableComponentFixtureIllegalStateException - if this fixture's JButton is disabled.IllegalStateException - if this fixture's JButton is not showing on the screen.public JButtonFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JButton.
Modifiers is a mask from the available InputEvent masks.pressAndReleaseKey in interface KeyboardInputSimulationFixturekeyPressInfo - 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.IllegalStateException - if this fixture's JButton is disabled.IllegalStateException - if this fixture's JButton is not showing on the screen.KeyPressInfopublic JButtonFixture pressAndReleaseKeys(int... keyCodes)
JButton.pressAndReleaseKeys in interface KeyboardInputSimulationFixturekeyCodes - 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.IllegalStateException - if this fixture's JButton is disabled.IllegalStateException - if this fixture's JButton is not showing on the screen.KeyEventpublic JButtonFixture pressKey(int keyCode)
JButton.pressKey in interface KeyboardInputSimulationFixturekeyCode - the code of the key to press.IllegalArgumentException - if any of the given code is not a valid key code.IllegalStateException - if this fixture's JButton is disabled.IllegalStateException - if this fixture's JButton is not showing on the screen.KeyEventpublic JButtonFixture releaseKey(int keyCode)
JButton.releaseKey in interface KeyboardInputSimulationFixturekeyCode - the code of the key to release.IllegalArgumentException - if any of the given code is not a valid key code.IllegalStateException - if this fixture's JButton is disabled.IllegalStateException - if this fixture's JButton is not showing on the screen.KeyEventpublic JButtonFixture requireFocused()
JButton has input focus.requireFocused in interface FocusableComponentFixtureAssertionError - if this fixture's JButton does not have input focus.public JButtonFixture requireEnabled()
JButton is enabled.requireEnabled in interface StateVerificationFixtureAssertionError - if this fixture's JButton is disabled.public JButtonFixture requireEnabled(Timeout timeout)
JButton is enabled.requireEnabled in interface StateVerificationFixturetimeout - the time this fixture will wait for the component to be enabled.WaitTimedOutError - if this fixture's JButton is never enabled.public JButtonFixture requireDisabled()
JButton is disabled.requireDisabled in interface StateVerificationFixtureAssertionError - if this fixture's JButton is enabled.public JButtonFixture requireVisible()
JButton is visible.requireVisible in interface StateVerificationFixtureAssertionError - if this fixture's JButton is not visible.public JButtonFixture requireNotVisible()
JButton is not visible.requireNotVisible in interface StateVerificationFixtureAssertionError - if this fixture's JButton is visible.public JButtonFixture requireText(String expected)
JButton matches the specified value.requireText in interface TextDisplayFixtureexpected - the text to match. It can be a regular expression.AssertionError - if the text of the target JButton does not match the given one.public JButtonFixture requireText(Pattern pattern)
JButton matches the given regular expression pattern.requireText in interface TextDisplayFixturepattern - the regular expression pattern to match.NullPointerException - if the given regular expression pattern is null.AssertionError - if the text of the target JButton does not match the given regular expression
pattern.public JButtonFixture requireToolTip(String expected)
JButton matches the given value.requireToolTip in interface ToolTipDisplayFixtureexpected - the given value. It can be a regular expression.AssertionError - if the toolTip in this fixture's JButton does not match the given value.public JButtonFixture requireToolTip(Pattern pattern)
JButton matches the given regular expression
pattern.requireToolTip in interface ToolTipDisplayFixturepattern - the regular expression pattern to match.NullPointerException - if the given regular expression pattern is null.AssertionError - if the toolTip in this fixture's JButton does not match the given regular
expression.public Object clientProperty(Object key)
JButton, under the given key.clientProperty in interface ClientPropertyStorageFixturekey - the key to use to retrieve the client property.null if the property was
not found.NullPointerException - if the given key is null.public JPopupMenuFixture showPopupMenu()
JButton as the invoker of the pop-up menu.showPopupMenu in interface JPopupMenuInvokerFixtureIllegalStateException - if this fixture's JButton is disabled.IllegalStateException - if this fixture's JButton is not showing on the screen.ComponentLookupException - if a pop-up menu cannot be found.public JPopupMenuFixture showPopupMenuAt(Point p)
JButton as the invoker of the
pop-up menu.showPopupMenuAt in interface JPopupMenuInvokerFixturep - the given point where to show the pop-up menu.IllegalStateException - if this fixture's JButton is disabled.IllegalStateException - if this fixture's JButton is not showing on the screen.ComponentLookupException - if a pop-up menu cannot be found.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.