|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.swing.driver.ComponentDriver
org.fest.swing.driver.ContainerDriver
org.fest.swing.driver.JComponentDriver
org.fest.swing.driver.JTextComponentDriver
public class JTextComponentDriver
Understands functional testing of
s:
JTextComponent
org.fest.swing.fixture
in your tests.
Field Summary |
---|
Fields inherited from class org.fest.swing.driver.ComponentDriver |
---|
robot |
Constructor Summary | |
---|---|
JTextComponentDriver(Robot robot)
Creates a new JTextComponentDriver . |
Method Summary | |
---|---|
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 . |
Methods inherited from class org.fest.swing.driver.JComponentDriver |
---|
clientProperty, invokeAction, isVisible, isVisible, requireToolTip, requireToolTip, scrollToVisible |
Methods inherited from class org.fest.swing.driver.ContainerDriver |
---|
move, resize, resizeHeight, resizeWidth |
Methods inherited from class org.fest.swing.driver.ComponentDriver |
---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JTextComponentDriver(Robot robot)
JTextComponentDriver
.
robot
- the robot to use to simulate user input.Method Detail |
---|
@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
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |