|
||||||||||
| 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.JListDriver
public class JListDriver
Understands functional testing of s:
JList
org.fest.swing.fixture in your tests.
| Field Summary |
|---|
| Fields inherited from class org.fest.swing.driver.ComponentDriver |
|---|
robot |
| Constructor Summary | |
|---|---|
JListDriver(Robot robot)
Creates a new JListDriver. |
|
| Method Summary | |
|---|---|
void |
cellReader(JListCellReader newCellReader)
Updates the implementation of to use when comparing internal values of a
and the values expected in a test. |
void |
clearSelection(JList list)
Clears the selection in the given . |
void |
clickItem(JList list,
int index,
MouseButton button,
int times)
Clicks the item under the given index, using the specified mouse button, the given number times. |
void |
clickItem(JList list,
Pattern pattern,
MouseButton button,
int times)
Clicks the first item matching the given regular expression pattern, using the specified mouse button, the given number times. |
void |
clickItem(JList list,
String value,
MouseButton button,
int times)
Clicks the first item matching the given value, using the specified mouse button, the given number times. |
String[] |
contentsOf(JList list)
Returns an array of Strings that represents the contents of the given ,
using this driver's . |
void |
drag(JList list,
int index)
Starts a drag operation at the location of the given index. |
void |
drag(JList list,
Pattern pattern)
Starts a drag operation at the location of the first item matching the given regular expression pattern. |
void |
drag(JList list,
String value)
Starts a drag operation at the location of the first item matching the given value. |
void |
drop(JList list)
Ends a drag operation at the center of the . |
void |
drop(JList list,
int index)
Ends a drag operation at the location of the given index. |
void |
drop(JList list,
Pattern pattern)
Ends a drag operation at the location of the first item matching the given regular expression pattern. |
void |
drop(JList list,
String value)
Ends a drag operation at the location of the first item matching the given value. |
int |
indexOf(JList list,
Pattern pattern)
Returns the index of the first item matching the given regular expression pattern. |
int |
indexOf(JList list,
String value)
Returns the index of the first item matching the given value. |
Point |
pointAt(JList list,
String value)
Returns the coordinates of the first item matching the given value. |
void |
requireItemCount(JList list,
int expected)
Verifies that number of items in the given is equal to the expected one. |
void |
requireNoSelection(JList list)
Verifies that the does not have a selection. |
void |
requireSelectedItems(JList list,
int... indices)
Verifies that the given item indices are selected in the . |
void |
requireSelectedItems(JList list,
Pattern... patterns)
Verifies that the selected items in the match the given regular expression patterns. |
void |
requireSelectedItems(JList list,
String... items)
Verifies that the selected items in the match the given values. |
void |
requireSelection(JList list,
int index)
Verifies that the selected index in the matches the given value. |
void |
requireSelection(JList list,
Pattern pattern)
Verifies that the selected item in the matches the given regular expression pattern. |
void |
requireSelection(JList list,
String value)
Verifies that the selected item in the matches the given value. |
String[] |
selectionOf(JList list)
Returns an array of Strings that represents the selection in the given ,
using this driver's . |
void |
selectItem(JList list,
int index)
Selects the item under the given index using left mouse button once. |
void |
selectItem(JList list,
Pattern pattern)
Selects the item in the given whose value matches the given regular expression pattern. |
void |
selectItem(JList list,
String value)
Selects the item in the given whose value matches the given one. |
void |
selectItems(JList list,
int[] indices)
Selects the items under the given indices. |
void |
selectItems(JList list,
int start,
int end)
Selects the items in the specified range. |
void |
selectItems(JList list,
Pattern[] patterns)
Selects the items matching the given regular expression patterns. |
void |
selectItems(JList list,
Range.From from,
Range.To to)
Selects the items in the specified range. |
void |
selectItems(JList list,
String[] values)
Selects the items matching the given values. |
JPopupMenu |
showPopupMenu(JList list,
int index)
Shows a pop-up menu at the location of the specified item in the . |
JPopupMenu |
showPopupMenu(JList list,
Pattern pattern)
Shows a pop-up menu at the location of the specified item in the . |
JPopupMenu |
showPopupMenu(JList list,
String value)
Shows a pop-up menu at the location of the specified item in the . |
String |
value(JList list,
int index)
Returns the String representation of the element under the given index, using this driver's
. |
| 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 JListDriver(Robot robot)
JListDriver.
robot - the robot to use to simulate user input.| Method Detail |
|---|
@RunsInEDT public String[] contentsOf(JList list)
Strings that represents the contents of the given JList,
using this driver's JListCellReader.
list - the target JList.
Strings that represents the contents of the given JList.cellReader(JListCellReader)
@RunsInEDT
public void selectItems(JList list,
String[] values)
list - the target JList.values - the values to match. Each String can be a regular expression.
NullPointerException - if the given array is null.
IllegalArgumentException - if the given array is empty.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
LocationUnavailableException - if an element matching the any of the given values cannot be found.
@RunsInEDT
public void selectItems(JList list,
Pattern[] patterns)
list - the target JList.patterns - the regular expression patterns to match.
NullPointerException - if the given array is null.
NullPointerException - if any of the regular expression patterns is null.
IllegalArgumentException - if the given array is empty.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
LocationUnavailableException - if an element matching the any of the given regular expression patterns cannot
be found.
@RunsInEDT
public void selectItem(JList list,
String value)
JList whose value matches the given one.
list - the target JList.value - the value to match.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
LocationUnavailableException - if an element matching the given value cannot be found.
@RunsInEDT
public void selectItem(JList list,
Pattern pattern)
JList whose value matches the given regular expression pattern.
list - the target JList.pattern - the regular expression to match.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
LocationUnavailableException - if an element matching the given value cannot be found.
NullPointerException - if the given regular expression pattern is null.
public void clickItem(JList list,
String value,
MouseButton button,
int times)
list - the target JList.value - the value to match.button - the button to use.times - the number of times to click.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
LocationUnavailableException - if an element matching the given value cannot be found.
public void clickItem(JList list,
Pattern pattern,
MouseButton button,
int times)
list - the target JList.pattern - the regular expression pattern to match.button - the button to use.times - the number of times to click.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
NullPointerException - if the given regular expression pattern is null.
LocationUnavailableException - if an element matching the given regular expression pattern cannot be found.
public void selectItems(JList list,
int[] indices)
list - the target JList.indices - the indices of the items to select.
NullPointerException - if the given array is null.
IllegalArgumentException - if the given array is empty.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
IndexOutOfBoundsException - if any of the indices is negative or greater than the index of the last item in
the JList.public void clearSelection(JList list)
JList. Since this method does not simulate user input, it
does not verifies that the JList is enabled and showing.
list - the target JList.
@RunsInEDT
public void selectItems(JList list,
Range.From from,
Range.To to)
list - the target JList.from - the starting point of the selection.to - the last item to select.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
IndexOutOfBoundsException - if the any index is negative or greater than the index of the last item in the
JList.
@RunsInEDT
public void selectItems(JList list,
int start,
int end)
list - the target JList.start - the starting point of the selection.end - the last item to select (inclusive.)
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
IndexOutOfBoundsException - if the any index is negative or greater than the index of the last item in the
JList.
@RunsInEDT
public void selectItem(JList list,
int index)
list - the target JList.index - the index of the item to click.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JList.
@RunsInEDT
public void clickItem(JList list,
int index,
MouseButton button,
int times)
list - the target JList.index - the index of the item to click.button - the button to use.times - the number of times to click.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JList.
@RunsInEDT
public void requireSelection(JList list,
String value)
JList matches the given value.
list - the target JList.value - the value to match. It can be a regular expression pattern.
AssertionError - if the selected item does not match the value.cellReader(JListCellReader)
@RunsInEDT
public void requireSelection(JList list,
Pattern pattern)
JList matches the given regular expression pattern.
list - the target JList.pattern - the regular expression pattern to match.
AssertionError - if the selected item does not match the given regular expression pattern.
NullPointerException - if the given regular expression pattern is null.cellReader(JListCellReader)
@RunsInEDT
public void requireSelection(JList list,
int index)
JList matches the given value.
list - the target JList.index - the selection index to match.
AssertionError - if the selected index does not match the value.@RunsInEDT public String[] selectionOf(JList list)
Strings that represents the selection in the given JList,
using this driver's JListCellReader.
list - the target JList.
Strings that represents the selection in the given JList.cellReader(JListCellReader)
@RunsInEDT
public void requireSelectedItems(JList list,
String... items)
JList match the given values.
list - the target JList.items - the values to match. Each value can be a regular expression pattern.
NullPointerException - if the given array is null.
IllegalArgumentException - if the given array is empty.
AssertionError - if the selected items do not match the given values.
@RunsInEDT
public void requireSelectedItems(JList list,
Pattern... patterns)
JList match the given regular expression patterns.
list - the target JList.patterns - the regular expression patterns to match.
NullPointerException - if the given array is null.
IllegalArgumentException - if the given array is empty.
NullPointerException - if any of the patterns in the array is null.
AssertionError - if the selected items do not match the given values.cellReader(JListCellReader)
@RunsInEDT
public void requireSelectedItems(JList list,
int... indices)
JList.
list - the target JList.indices - the expected indices of the selected items.
NullPointerException - if the given array is null.
IllegalArgumentException - if the given array is empty.
AssertionError - if the selection in the JList does not match the given one.@RunsInEDT public void requireNoSelection(JList list)
JList does not have a selection.
list - the target JList.
AssertionError - if the JList has a selection.
@RunsInEDT
public void drag(JList list,
String value)
list - the target JList.value - the value to match. It can be a regular expression.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
LocationUnavailableException - if an element matching the given value cannot be found.cellReader(JListCellReader)
@RunsInEDT
public void drag(JList list,
Pattern pattern)
list - the target JList.pattern - the regular expression pattern to match.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
NullPointerException - if the regular expression pattern is null.
LocationUnavailableException - if an element matching the given regular expression pattern cannot be found.cellReader(JListCellReader)
@RunsInEDT
public void drop(JList list,
String value)
list - the target JList.value - the value to match. It can be a regular expression.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
LocationUnavailableException - if an element matching the given value cannot be found.
ActionFailedException - if there is no drag action in effect.
public void drop(JList list,
Pattern pattern)
list - the target JList.pattern - the regular expression pattern to match.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
NullPointerException - if the given regular expression pattern is null.
LocationUnavailableException - if an element matching the given value cannot be found.
ActionFailedException - if there is no drag action in effect.
@RunsInEDT
public void drag(JList list,
int index)
list - the target JList.index - the given index.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JList.
@RunsInEDT
public void drop(JList list,
int index)
list - the target JList.index - the given index.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JList.
ActionFailedException - if there is no drag action in effect.@RunsInEDT public void drop(JList list)
JList.
list - the target JList.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
ActionFailedException - if there is no drag action in effect.
@RunsInEDT
public JPopupMenu showPopupMenu(JList list,
String value)
JList.
list - the target JList.value - the value to match. It can be a regular expression pattern.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
ComponentLookupException - if a pop-up menu cannot be found.
LocationUnavailableException - if an element matching the given value cannot be found.
@RunsInEDT
public JPopupMenu showPopupMenu(JList list,
Pattern pattern)
JList.
list - the target JList.pattern - the regular expression pattern to match.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
NullPointerException - if the regular expression pattern is null.
ComponentLookupException - if a pop-up menu cannot be found.
LocationUnavailableException - if an element matching the given value cannot be found.
@RunsInEDT
public JPopupMenu showPopupMenu(JList list,
int index)
JList.
list - the target JList.index - the index of the item.
IllegalStateException - if the JList is disabled.
IllegalStateException - if the JList is not showing on the screen.
ComponentLookupException - if a pop-up menu cannot be found.
IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JList.
@RunsInEDT
public Point pointAt(JList list,
String value)
list - the target JList.value - the value to match.
LocationUnavailableException - if an element matching the given value cannot be found.
@RunsInEDT
public int indexOf(JList list,
String value)
list - the target JListvalue - the value to match. It can be a regular expression.
LocationUnavailableException - if an element matching the given value cannot be found.
@RunsInEDT
public int indexOf(JList list,
Pattern pattern)
list - the target JList.pattern - the regular expression pattern to match.
LocationUnavailableException - if an element matching the given value cannot be found.
NullPointerException - if the given regular expression pattern is null.
@RunsInEDT
public String value(JList list,
int index)
String representation of the element under the given index, using this driver's
JListCellReader.
list - the target JList.index - the given index.
IndexOutOfBoundsException - if the given index is negative or greater than the index of the last item in the
JList.cellReader(JListCellReader)public void cellReader(JListCellReader newCellReader)
JListCellReader to use when comparing internal values of a
JList and the values expected in a test.
newCellReader - the new JListCellValueReader to use.
NullPointerException - if newCellReader is null.
@RunsInEDT
public void requireItemCount(JList list,
int expected)
JList is equal to the expected one.
list - the target JList.expected - the expected number of items.
AssertionError - if the number of items in the given JList is not equal to the expected
one.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||