Package org.fest.swing.fixture
Interface ItemGroupFixture
- All Known Implementing Classes:
JComboBoxFixture
,JListFixture
public interface ItemGroupFixture
-
Method Summary
Modifier and TypeMethodDescriptionClears the selection in this fixture's
.Component
String[]
contents()
Returns theString
representation of the elements in this fixture's
.Component
requireItemCount
(int expected) Verifies that this fixture's
has the expected number of itemsComponent
Verifies that this fixture's
does not have a selection.Component
requireSelection
(int index) Verifies that the index of the selected item in this fixture's
is equal to the given value.Component
requireSelection
(String value) Verifies that the value of the selected item in this fixture's
matches the given value.Component
requireSelection
(Pattern pattern) Verifies that the value of the selected item in this fixture's
matches the given regular expression pattern.Component
selectItem
(int index) Simulates a user selecting an item in this fixture's
.Component
selectItem
(String value) Simulates a user selecting an item in this fixture's
.Component
selectItem
(Pattern pattern) Simulates a user selecting an item in this fixture's
.Component
valueAt
(int index) Returns the value of an item in the
managed by this fixture.Component
-
Method Details
-
contents
String[] contents()Returns theString
representation of the elements in this fixture's
.Component
- Returns:
- the
String
representation of the elements in this fixture'sComponent
.
-
clearSelection
ItemGroupFixture clearSelection()Clears the selection in this fixture's
.Component
- Returns:
- this fixture.
- Since:
- 1.2
-
selectItem
Simulates a user selecting an item in this fixture's
.Component
- Parameters:
index
- the index of the item to select.- Returns:
- this fixture.
-
selectItem
Simulates a user selecting an item in this fixture's
.Component
- Parameters:
value
- the value of the item to select. It can be a regular expression.- Returns:
- this fixture.
-
selectItem
Simulates a user selecting an item in this fixture's
. The text of the item to select must match the given regular expression pattern.Component
- Parameters:
pattern
- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given regular expression pattern isnull
.- Since:
- 1.2
-
valueAt
Returns the value of an item in the
managed by this fixture. If the value is not meaningful, this method will returnComponent
null
.- Parameters:
index
- the index of the item to return.- Returns:
- the value of the item under the given index, or
null
if nothing meaningful.
-
requireSelection
Verifies that the value of the selected item in this fixture's
matches the given value.Component
- Parameters:
value
- the value to match. It can be a regular expression.- Returns:
- this fixture.
- Throws:
AssertionError
- if the selected item does not match the given value.
-
requireSelection
Verifies that the value of the selected item in this fixture's
matches the given regular expression pattern.Component
- Parameters:
pattern
- the regular expression pattern to match.- Returns:
- this fixture.
- Throws:
NullPointerException
- if the given regular expression pattern isnull
.AssertionError
- if the selected item does not match the given regular expression pattern.- Since:
- 1.2
-
requireSelection
Verifies that the index of the selected item in this fixture's
is equal to the given value.Component
- Parameters:
index
- the expected selection index.- Returns:
- this fixture.
- Throws:
AssertionError
- if the selection index is not equal to the given value.- Since:
- 1.2
-
requireNoSelection
ItemGroupFixture requireNoSelection()Verifies that this fixture's
does not have a selection.Component
- Returns:
- this fixture.
- Throws:
AssertionError
- if this fixture'sComponent
has a selection.
-
requireItemCount
Verifies that this fixture's
has the expected number of itemsComponent
- Parameters:
expected
- the expected number of items.- Returns:
- this fixture.
- Throws:
AssertionError
- if the number of items in this fixture'sComponent
is not equal to the expected one.- Since:
- 1.2
-