public class JTextComponentDriver extends JComponentDriver implements TextDisplayDriver<JTextComponent>
JTextComponents:
org.fest.swing.fixture in your tests.robot| Constructor and Description |
|---|
JTextComponentDriver(Robot robot)
Creates a new
JTextComponentDriver. |
| Modifier and Type | Method and Description |
|---|---|
void |
deleteText(JTextComponent textBox)
Deletes the text of the
. |
void |
enterText(JTextComponent textBox,
String text)
Types the given text into the
. |
void |
replaceText(JTextComponent textBox,
String text)
Types the given text into the
, replacing any existing text already there. |
void |
requireEditable(JTextComponent textBox)
Asserts that the given
is editable. |
void |
requireEmpty(JTextComponent textBox)
Asserts that the given
is empty. |
void |
requireNotEditable(JTextComponent textBox)
Asserts that the given
is not editable. |
void |
requireText(JTextComponent textBox,
Pattern pattern)
Asserts that the text in the given
matches the given regular expression
pattern. |
void |
requireText(JTextComponent textBox,
String expected)
Asserts that the text in the given
is equal to the specified value. |
void |
selectAll(JTextComponent textBox)
Selects the text in the
. |
void |
selectText(JTextComponent textBox,
int start,
int end)
Select the given text range.
|
void |
selectText(JTextComponent textBox,
String text)
Select the given text range.
|
void |
setText(JTextComponent textBox,
String text)
Sets the given text into the
. |
String |
textOf(JTextComponent textBox)
Returns the text of the given
. |
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisiblemove, resize, resizeHeight, resizeWidthassertIsEnabledAndShowing, 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, waitForShowingpublic JTextComponentDriver(Robot robot)
JTextComponentDriver.robot - the robot to use to simulate user input.@RunsInEDT public void deleteText(JTextComponent textBox)
JTextComponent.textBox - the target JTextComponent.IllegalStateException - if the JTextComponent is disabled.IllegalStateException - if the JTextComponent is not showing on the screen.@RunsInEDT public void replaceText(JTextComponent textBox, String text)
JTextComponent, replacing any existing text already there.textBox - the target JTextComponent.text - the text to enter.NullPointerException - if the text to enter is null.IllegalArgumentException - if the text to enter is empty.IllegalStateException - if the JTextComponent is disabled.IllegalStateException - if the JTextComponent is not showing on the screen.@RunsInEDT public void selectAll(JTextComponent textBox)
JTextComponent.textBox - the target JTextComponent.IllegalStateException - if the JTextComponent is disabled.IllegalStateException - if the JTextComponent is not showing on the screen.@RunsInEDT public void enterText(JTextComponent textBox, String text)
JTextComponent.textBox - the target JTextComponent.text - the text to enter.IllegalStateException - if the JTextComponent is disabled.IllegalStateException - if the JTextComponent is not showing on the screen.@RunsInEDT public void setText(JTextComponent textBox, String text)
JTextComponent. Unlike
enterText(JTextComponent, 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.
textBox - the target JTextComponent.text - the text to enter.IllegalStateException - if the JTextComponent is disabled.IllegalStateException - if the JTextComponent is not showing on the screen.@RunsInEDT public void selectText(JTextComponent textBox, String text)
textBox - the target JTextComponent.text - the text to select.IllegalStateException - if the JTextComponent is disabled.IllegalStateException - if the JTextComponent is not showing on the screen.IllegalArgumentException - if the JTextComponent does not contain the given text to select.ActionFailedException - if selecting the text fails.@RunsInEDT public void selectText(JTextComponent textBox, int start, int end)
textBox - the target JTextComponent.start - the starting index of the selection.end - the ending index of the selection.IllegalStateException - if the JTextComponent is disabled.IllegalStateException - if the JTextComponent is not showing on the screen.ActionFailedException - if selecting the text in the given range fails.@RunsInEDT public void requireText(JTextComponent textBox, String expected)
JTextComponent is equal to the specified value.requireText in interface TextDisplayDriver<JTextComponent>textBox - the given JTextComponent.expected - the text to match. It can be a regular expression pattern.AssertionError - if the text of the JTextComponent is not equal to the given one.@RunsInEDT public void requireText(JTextComponent textBox, Pattern pattern)
JTextComponent matches the given regular expression
pattern.requireText in interface TextDisplayDriver<JTextComponent>textBox - the given JTextComponent.pattern - the regular expression pattern to match.NullPointerException - if the given regular expression pattern is null.AssertionError - if the text of the JTextComponent is not equal to the given one.@RunsInEDT public void requireEmpty(JTextComponent textBox)
JTextComponent is empty.textBox - the given JTextComponent.AssertionError - if the JTextComponent is not empty.@RunsInEDT public void requireEditable(JTextComponent textBox)
JTextComponent is editable.textBox - the given JTextComponent.AssertionError - if the JTextComponent is not editable.@RunsInEDT public void requireNotEditable(JTextComponent textBox)
JTextComponent is not editable.textBox - the given JTextComponent.AssertionError - if the JTextComponent is editable.@RunsInEDT public String textOf(JTextComponent textBox)
JTextComponent.textOf in interface TextDisplayDriver<JTextComponent>textBox - the given JTextComponent.JTextComponent.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.