public class JTextComponentFixture extends ComponentFixture<JTextComponent> implements CommonComponentFixture, JComponentFixture, JPopupMenuInvokerFixture, TextInputFixture
JTextComponents:
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target| Constructor and Description |
|---|
JTextComponentFixture(Robot robot,
JTextComponent target)
Creates a new
. |
JTextComponentFixture(Robot robot,
String textComponentName)
Creates a new
. |
| Modifier and Type | Method and Description |
|---|---|
JTextComponentFixture |
click()
Simulates a user clicking this fixture's
. |
JTextComponentFixture |
click(MouseButton button)
Simulates a user clicking this fixture's
. |
JTextComponentFixture |
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. |
JTextComponentFixture |
deleteText()
Simulates a user deleting all the text in this fixture's
. |
JTextComponentFixture |
doubleClick()
Simulates a user double-clicking this fixture's
. |
protected void |
driver(JTextComponentDriver newDriver)
Sets the
to be used by this fixture. |
JTextComponentFixture |
enterText(String text)
Simulates a user entering the given text in this fixture's
. |
JTextComponentFixture |
focus()
Gives input focus to this fixture's
. |
JTextComponentFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's
. |
JTextComponentFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys in this fixture's
. |
JTextComponentFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's
. |
JTextComponentFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's
. |
JTextComponentFixture |
requireDisabled()
Asserts that this fixture's
is disabled. |
JTextComponentFixture |
requireEditable()
Asserts that this fixture's
is editable. |
JTextComponentFixture |
requireEmpty()
Asserts that the target text component does not contain any text.
|
JTextComponentFixture |
requireEnabled()
Asserts that this fixture's
is enabled. |
JTextComponentFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's
is enabled. |
JTextComponentFixture |
requireFocused()
Asserts that this fixture's
has input focus. |
JTextComponentFixture |
requireNotEditable()
Asserts that this fixture's
is not editable. |
JTextComponentFixture |
requireNotVisible()
Asserts that this fixture's
is not visible. |
JTextComponentFixture |
requireText(Pattern pattern)
Asserts that the text of this fixture's
matches the given regular expression
pattern. |
JTextComponentFixture |
requireText(String expected)
Asserts that the text of this fixture's
is equal to the specified value. |
JTextComponentFixture |
requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's
matches the given regular expression
pattern. |
JTextComponentFixture |
requireToolTip(String expected)
Asserts that the toolTip in this fixture's
matches the given value. |
JTextComponentFixture |
requireVisible()
Asserts that this fixture's
is visible. |
JTextComponentFixture |
rightClick()
Simulates a user right-clicking this fixture's
. |
JTextComponentFixture |
select(String text)
Simulates a user selecting the given text contained in this fixture's
. |
JTextComponentFixture |
selectAll()
Simulates a user selecting all the text contained in this fixture's
. |
JTextComponentFixture |
selectText(int start,
int end)
Simulates a user selecting a portion of the text contained in this fixture's
. |
JTextComponentFixture |
setText(String text)
Sets the text in 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 JTextComponentFixture(Robot robot, JTextComponent target)
JTextComponentFixture.robot - performs simulation of user events on the given JTextComponent.target - the JTextComponent to be managed by this fixture.NullPointerException - if robot is null.NullPointerException - if target is null.public JTextComponentFixture(Robot robot, String textComponentName)
JTextComponentFixture.robot - performs simulation of user events on a JTextComponent.textComponentName - the name of the JTextComponent to find using the given Robot.NullPointerException - if robot is null.ComponentLookupException - if a matching JTextComponent could not be found.ComponentLookupException - if more than one matching JTextComponent is found.protected final void driver(JTextComponentDriver newDriver)
JTextComponentDriver to be used by this fixture.newDriver - the new JTextComponentDriver.NullPointerException - if the given driver is null.public String text()
JTextComponent.text in interface TextDisplayFixtureJTextComponent.public JTextComponentFixture select(String text)
JTextComponent.select in interface TextInputFixturetext - the text to select.IllegalStateException - if this fixture's JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.IllegalArgumentException - if this fixture's JTextComponent does not contain the given text to
select.ActionFailedException - if the selecting the text in the given range fails.public JTextComponentFixture selectText(int start, int end)
JTextComponent.selectText in interface TextInputFixturestart - index where selection should start.end - index where selection should end.IllegalStateException - if this fixture's JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.ActionFailedException - if the selecting the text in the given range fails.public JTextComponentFixture selectAll()
JTextComponent.selectAll in interface TextInputFixtureIllegalStateException - if this fixture's JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.public JTextComponentFixture click()
JTextComponent.click in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.public JTextComponentFixture click(MouseButton button)
JTextComponent.click in interface MouseInputSimulationFixturebutton - the button to click.NullPointerException - if the given MouseButton is null.IllegalStateException - if this fixture's JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.public JTextComponentFixture click(MouseClickInfo mouseClickInfo)
JTextComponent.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 JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.public JTextComponentFixture doubleClick()
JTextComponent.doubleClick in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.public JTextComponentFixture rightClick()
JTextComponent.rightClick in interface MouseInputSimulationFixtureIllegalStateException - if this fixture's JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.public JTextComponentFixture deleteText()
JTextComponent.deleteText in interface TextInputFixtureIllegalStateException - if this fixture's JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.public JTextComponentFixture enterText(String text)
JTextComponent.enterText in interface TextInputFixturetext - the text to enter.IllegalStateException - if this fixture's JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.public JTextComponentFixture setText(String text)
JTextComponent. Unlike
enterText(String), this method bypasses the event system and allows immediate updating on the
underlying document model.
Primarily desired for speeding up tests when precise user event fidelity isn't necessary.
text - the text to set.IllegalStateException - if this fixture's JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.public JTextComponentFixture focus()
JTextComponent.focus in interface FocusableComponentFixtureIllegalStateException - if this fixture's JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.public JTextComponentFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JTextComponent.
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 JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.KeyPressInfopublic JTextComponentFixture pressAndReleaseKeys(int... keyCodes)
JTextComponent. This
method does not affect the current focus.pressAndReleaseKeys in interface KeyboardInputSimulationFixturekeyCodes - the 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 JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.KeyEventpublic JTextComponentFixture pressKey(int keyCode)
JTextComponent.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 JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.KeyEventpublic JTextComponentFixture releaseKey(int keyCode)
JTextComponent.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 JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.KeyEventpublic JTextComponentFixture requireText(String expected)
JTextComponent is equal to the specified value.requireText in interface TextDisplayFixtureexpected - the text to match. It can be a regular expression pattern.AssertionError - if the text of this fixture's JTextComponent is not equal to the given one.public JTextComponentFixture requireText(Pattern pattern)
JTextComponent 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 this fixture's JTextComponent is not eual to the given one.public JTextComponentFixture requireEmpty()
AssertionError - if the target text component is not empty.public JTextComponentFixture requireFocused()
JTextComponent has input focus.requireFocused in interface FocusableComponentFixtureAssertionError - if this fixture's JTextComponent does not have input focus.public JTextComponentFixture requireEnabled()
JTextComponent is enabled.requireEnabled in interface StateVerificationFixtureAssertionError - if this fixture's JTextComponent is disabled.public JTextComponentFixture requireEnabled(Timeout timeout)
JTextComponent is enabled.requireEnabled in interface StateVerificationFixturetimeout - the time this fixture will wait for the component to be enabled.WaitTimedOutError - if this fixture's JTextComponent is never enabled.public JTextComponentFixture requireDisabled()
JTextComponent is disabled.requireDisabled in interface StateVerificationFixtureAssertionError - if this fixture's JTextComponent is enabled.public JTextComponentFixture requireVisible()
JTextComponent is visible.requireVisible in interface StateVerificationFixtureAssertionError - if this fixture's JTextComponent is not visible.public JTextComponentFixture requireNotVisible()
JTextComponent is not visible.requireNotVisible in interface StateVerificationFixtureAssertionError - if this fixture's JTextComponent is visible.public JTextComponentFixture requireEditable()
JTextComponent is editable.requireEditable in interface EditableComponentFixtureAssertionError - if this fixture's JTextComponent is not editable.public JTextComponentFixture requireNotEditable()
JTextComponent is not editable.requireNotEditable in interface EditableComponentFixtureAssertionError - if this fixture's JTextComponent is editable.public JTextComponentFixture requireToolTip(String expected)
JTextComponent 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 JTextComponent does not match the given
value.public JTextComponentFixture requireToolTip(Pattern pattern)
JTextComponent 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 JTextComponent does not match the given
regular expression pattern.public Object clientProperty(Object key)
JTextComponent, 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()
JTextComponent as the invoker of the pop-up menu.showPopupMenu in interface JPopupMenuInvokerFixtureIllegalStateException - if this fixture's JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent is not showing on the screen.ComponentLookupException - if a pop-up menu cannot be found.public JPopupMenuFixture showPopupMenuAt(Point p)
JTextComponent 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 JTextComponent is disabled.IllegalStateException - if this fixture's JTextComponent 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.