org.fest.swing.fixture
Interface ItemGroupFixture

All Known Implementing Classes:
JComboBoxFixture, JListFixture

public interface ItemGroupFixture

Understands functional testing of GUI components that contains or display a group of items:

Understands simulation of user events on a Component that contains or displays a group of items, and verification of the state of such Component.

Author:
Alex Ruiz, Yvonne Wang

Method Summary
 ItemGroupFixture clearSelection()
          Clears the selection in this fixture's Component.
 String[] contents()
          Returns the String representation of the elements in this fixture's Component.
 ItemGroupFixture requireItemCount(int expected)
          Verifies that this fixture's Component has the expected number of items
 ItemGroupFixture requireNoSelection()
          Verifies that this fixture's Component does not have a selection.
 ItemGroupFixture requireSelection(int index)
          Verifies that the index of the selected item in this fixture's Component is equal to the given value.
 ItemGroupFixture requireSelection(Pattern pattern)
          Verifies that the value of the selected item in this fixture's Component matches the given regular expression pattern.
 ItemGroupFixture requireSelection(String value)
          Verifies that the value of the selected item in this fixture's Component matches the given value.
 ItemGroupFixture selectItem(int index)
          Simulates a user selecting an item in this fixture's Component.
 ItemGroupFixture selectItem(Pattern pattern)
          Simulates a user selecting an item in this fixture's Component.
 ItemGroupFixture selectItem(String value)
          Simulates a user selecting an item in this fixture's Component.
 Object valueAt(int index)
          Returns the value of an item in the Component managed by this fixture.
 

Method Detail

contents

String[] contents()
Returns the String representation of the elements in this fixture's Component.

Returns:
the String representation of the elements in this fixture's Component.

clearSelection

ItemGroupFixture clearSelection()
Clears the selection in this fixture's Component.

Returns:
this fixture.
Since:
1.2

selectItem

ItemGroupFixture selectItem(int index)
Simulates a user selecting an item in this fixture's Component.

Parameters:
index - the index of the item to select.
Returns:
this fixture.

selectItem

ItemGroupFixture selectItem(String value)
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

ItemGroupFixture selectItem(Pattern pattern)
Simulates a user selecting an item in this fixture's Component. The text of the item to select must match the given regular expression pattern.

Parameters:
pattern - the regular expression pattern to match.
Returns:
this fixture.
Throws:
NullPointerException - if the given regular expression pattern is null.
Since:
1.2

valueAt

Object valueAt(int index)
Returns the value of an item in the Component managed by this fixture. If the value is not meaningful, this method will return 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

ItemGroupFixture requireSelection(String value)
Verifies that the value of the selected item in this fixture's Component matches the given value.

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

ItemGroupFixture requireSelection(Pattern pattern)
Verifies that the value of the selected item in this fixture's Component matches the given regular expression pattern.

Parameters:
pattern - the regular expression pattern to match.
Returns:
this fixture.
Throws:
NullPointerException - if the given regular expression pattern is null.
AssertionError - if the selected item does not match the given regular expression pattern.
Since:
1.2

requireSelection

ItemGroupFixture requireSelection(int index)
Verifies that the index of the selected item in this fixture's Component is equal to the given value.

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 Component does not have a selection.

Returns:
this fixture.
Throws:
AssertionError - if this fixture's Component has a selection.

requireItemCount

ItemGroupFixture requireItemCount(int expected)
Verifies that this fixture's Component has the expected number of items

Parameters:
expected - the expected number of items.
Returns:
this fixture.
Throws:
AssertionError - if the number of items in this fixture's Component is not equal to the expected one.
Since:
1.2


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.