|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.fest.swing.fixture.ComponentFixture<JComboBox>
org.fest.swing.fixture.JComboBoxFixture
public class JComboBoxFixture
Understands functional testing of
es:
JComboBox
The conversion between the values given in tests and the values being displayed by a
renderer is performed by a JComboBox
. This fixture uses a
JComboBoxCellReader
by default.
JComboBoxCellReader
Field Summary |
---|
Fields inherited from class org.fest.swing.fixture.ComponentFixture |
---|
BACKGROUND_PROPERTY, FONT_PROPERTY, FOREGROUND_PROPERTY, robot, target |
Constructor Summary | |
---|---|
JComboBoxFixture(Robot robot,
JComboBox target)
Creates a new . |
|
JComboBoxFixture(Robot robot,
String comboBoxName)
Creates a new . |
Method Summary | |
---|---|
JComboBoxFixture |
cellReader(JComboBoxCellReader cellReader)
Updates the implementation of to use when comparing internal values
of this fixture's and the values expected in a test. |
JComboBoxFixture |
clearSelection()
Clears the selection in this fixture's . |
JComboBoxFixture |
click()
Simulates a user clicking this fixture's . |
JComboBoxFixture |
click(MouseButton button)
Simulates a user clicking this fixture's . |
JComboBoxFixture |
click(MouseClickInfo mouseClickInfo)
Simulates a user clicking this fixture's . |
Object |
clientProperty(Object key)
Returns the client property stored in this fixture's , under the given key. |
String[] |
contents()
Returns the String representation of the elements in this fixture's ,
using this fixture's . |
JComboBoxFixture |
doubleClick()
Simulates a user double-clicking this fixture's . |
protected void |
driver(JComboBoxDriver newDriver)
Sets the to be used by this fixture. |
JComboBoxFixture |
enterText(String text)
Simulates a user entering the specified text in this fixture's . |
JComboBoxFixture |
focus()
Gives input focus to this fixture's . |
JList |
list()
Finds and returns the JList in the pop-up raised by this fixture's . |
JComboBoxFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's . |
JComboBoxFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's . |
JComboBoxFixture |
pressKey(int keyCode)
Simulates a user pressing the given key on this fixture's . |
JComboBoxFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's . |
JComboBoxFixture |
replaceText(String text)
Simulates a user entering the specified text in the , replacing any text. |
JComboBoxFixture |
requireDisabled()
Asserts that this fixture's is disabled. |
JComboBoxFixture |
requireEditable()
Asserts that this fixture's is editable. |
JComboBoxFixture |
requireEnabled()
Asserts that this fixture's is enabled. |
JComboBoxFixture |
requireEnabled(Timeout timeout)
Asserts that this fixture's is enabled. |
JComboBoxFixture |
requireFocused()
Asserts that this fixture's has input focus. |
JComboBoxFixture |
requireItemCount(int expected)
Verifies that this fixture's has the expected number of items |
JComboBoxFixture |
requireNoSelection()
Verifies that this fixture's does not have any selection. |
JComboBoxFixture |
requireNotEditable()
Asserts that this fixture's is not editable. |
JComboBoxFixture |
requireNotVisible()
Asserts that this fixture's is not visible. |
JComboBoxFixture |
requireSelection(int index)
Verifies that the index of the selected item in this fixture's is equal to the given
value. |
JComboBoxFixture |
requireSelection(Pattern pattern)
Verifies that the String representation of the selected item in this fixture's
matches the given regular expression pattern. |
JComboBoxFixture |
requireSelection(String value)
Verifies that the String representation of the selected item in this fixture's
matches the given text. |
JComboBoxFixture |
requireToolTip(Pattern pattern)
Asserts that the toolTip in this fixture's matches the given regular expression
pattern. |
JComboBoxFixture |
requireToolTip(String expected)
Asserts that the toolTip in this fixture's matches the given value. |
JComboBoxFixture |
requireVisible()
Asserts that this fixture's is visible. |
JComboBoxFixture |
rightClick()
Simulates a user right-clicking this fixture's . |
JComboBoxFixture |
selectAllText()
Simulates a user selecting the text in the . |
JComboBoxFixture |
selectItem(int index)
Simulates a user selecting an item in this fixture's . |
JComboBoxFixture |
selectItem(Pattern pattern)
Simulates a user selecting an item in this fixture's . |
JComboBoxFixture |
selectItem(String text)
Simulates a user selecting an item in this fixture's . |
JPopupMenuFixture |
showPopupMenu()
Shows a pop-up menu using this fixture's as the invoker of the pop-up menu. |
JPopupMenuFixture |
showPopupMenuAt(Point p)
Shows a pop-up menu at the given point using this fixture's as the invoker of the
pop-up menu. |
String |
valueAt(int index)
Returns the String representation of the value of an item in this fixture's
, using this fixture's . |
Methods inherited from class org.fest.swing.fixture.ComponentFixture |
---|
background, component, font, foreground, requireShowing, targetCastedTo, validateNotNull |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JComboBoxFixture(Robot robot, JComboBox target)
JComboBoxFixture
.
robot
- performs simulation of user events on the given JComboBox
.target
- the JComboBox
to be managed by this fixture.
NullPointerException
- if robot
is null
.
NullPointerException
- if target
is null
.public JComboBoxFixture(Robot robot, String comboBoxName)
JComboBoxFixture
.
robot
- performs simulation of user events on a JComboBox
.comboBoxName
- the name of the JComboBox
to find using the given Robot
.
NullPointerException
- if robot
is null
.
ComponentLookupException
- if a matching JComboBox
could not be found.
ComponentLookupException
- if more than one matching JComboBox
is found.Method Detail |
---|
protected final void driver(JComboBoxDriver newDriver)
JComboBoxDriver
to be used by this fixture.
newDriver
- the new JComboBoxDriver
.
NullPointerException
- if the given driver is null
.public JComboBoxFixture click()
JComboBox
.
click
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.public JComboBoxFixture click(MouseButton button)
JComboBox
.
click
in interface MouseInputSimulationFixture
button
- the button to click.
NullPointerException
- if the given MouseButton
is null
.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.public JComboBoxFixture click(MouseClickInfo mouseClickInfo)
JComboBox
.
click
in interface MouseInputSimulationFixture
mouseClickInfo
- specifies the button to click and the times the button should be clicked.
NullPointerException
- if the given MouseClickInfo
is null
.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.public JComboBoxFixture doubleClick()
JComboBox
.
doubleClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.public JComboBoxFixture rightClick()
JComboBox
.
rightClick
in interface MouseInputSimulationFixture
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.public String[] contents()
String
representation of the elements in this fixture's JComboBox
,
using this fixture's JComboBoxCellReader
.
contents
in interface ItemGroupFixture
String
representation of the elements in this fixture's JComboBox
.cellReader(JComboBoxCellReader)
public JComboBoxFixture replaceText(String text)
JComboBox
, replacing any text. This action
is executed only if the JComboBox
is editable.
text
- the text to enter.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.
IllegalStateException
- if this fixture's JComboBox
is not editable.public JComboBoxFixture selectAllText()
JComboBox
. This action is executed only if the
JComboBox
is editable.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.
IllegalStateException
- if this fixture's JComboBox
is not editable.public JComboBoxFixture enterText(String text)
JComboBox
. This action is
executed only if the JComboBox
is editable.
text
- the text to enter.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.
IllegalStateException
- if this fixture's JComboBox
is not editable.
ActionFailedException
- if this fixture's JComboBox
does not have an editor.public JComboBoxFixture focus()
JComboBox
.
focus
in interface FocusableComponentFixture
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.public JList list()
JList
in the pop-up raised by this fixture's JComboBox
.
JList
in the pop-up raised by this fixture's JComboBox
.
ComponentLookupException
- if the JList
in the pop-up could not be found.public JComboBoxFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
JComboBox
.
Modifiers is a mask from the available InputEvent
masks.
pressAndReleaseKey
in interface KeyboardInputSimulationFixture
keyPressInfo
- specifies the key and modifiers to press.
NullPointerException
- if the given KeyPressInfo
is null
.
IllegalArgumentException
- if the given code is not a valid key code.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.KeyPressInfo
public JComboBoxFixture pressAndReleaseKeys(int... keyCodes)
JComboBox
.
pressAndReleaseKeys
in interface KeyboardInputSimulationFixture
keyCodes
- one or more codes of the keys to press.
NullPointerException
- if the given array of codes is null
.
IllegalArgumentException
- if any of the given code is not a valid key code.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.KeyEvent
public JComboBoxFixture pressKey(int keyCode)
JComboBox
.
pressKey
in interface KeyboardInputSimulationFixture
keyCode
- the code of the key to press.
IllegalArgumentException
- if any of the given code is not a valid key code.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.KeyEvent
public JComboBoxFixture releaseKey(int keyCode)
JComboBox
.
releaseKey
in interface KeyboardInputSimulationFixture
keyCode
- the code of the key to release.
IllegalArgumentException
- if any of the given code is not a valid key code.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.KeyEvent
public JComboBoxFixture clearSelection()
JComboBox
. Since this method does not simulate user
input, it does not verifies that this fixture's JComboBox
is enabled and showing.
clearSelection
in interface ItemGroupFixture
public JComboBoxFixture selectItem(int index)
JComboBox
.
selectItem
in interface ItemGroupFixture
index
- the index of the item to select.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.
IndexOutOfBoundsException
- if the given index is negative or greater than the index of the last item in the
JComboBox
.public JComboBoxFixture selectItem(String text)
JComboBox
. The text of the item to
select must match the given String
. Such text is retrieved by this fixture's
JComboBoxCellReader
.
selectItem
in interface ItemGroupFixture
text
- the text of the item to select. It can be a regular expression.
LocationUnavailableException
- if an element matching the given text cannot be found.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.cellReader(JComboBoxCellReader)
public JComboBoxFixture selectItem(Pattern pattern)
JComboBox
. The text of the item to
select must match the given regular expression pattern. Such text is retrieved by this fixture's
JComboBoxCellReader
.
selectItem
in interface ItemGroupFixture
pattern
- the regular expression pattern to match.
LocationUnavailableException
- if an element matching the given pattern cannot be found.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.
NullPointerException
- if the given regular expression pattern is null
.cellReader(JComboBoxCellReader)
public String valueAt(int index)
String
representation of the value of an item in this fixture's
JComboBox
, using this fixture's JComboBoxCellReader
.
valueAt
in interface ItemGroupFixture
index
- the index of the item to return.
String
representation of the value of an item in this fixture's JComboBox
.
IndexOutOfBoundsException
- if the given index is negative or greater than the index of the last item in the
JComboBox
.cellReader(JComboBoxCellReader)
public JComboBoxFixture requireEnabled()
JComboBox
is enabled.
requireEnabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JComboBox
is disabled.public JComboBoxFixture requireFocused()
JComboBox
has input focus.
requireFocused
in interface FocusableComponentFixture
AssertionError
- if this fixture's JComboBox
does not have input focus.public JComboBoxFixture requireEnabled(Timeout timeout)
JComboBox
is enabled.
requireEnabled
in interface StateVerificationFixture
timeout
- the time this fixture will wait for the component to be enabled.
WaitTimedOutError
- if this fixture's JComboBox
is never enabled.public JComboBoxFixture requireDisabled()
JComboBox
is disabled.
requireDisabled
in interface StateVerificationFixture
AssertionError
- if this fixture's JComboBox
is enabled.public JComboBoxFixture requireVisible()
JComboBox
is visible.
requireVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JComboBox
is not visible.public JComboBoxFixture requireNotVisible()
JComboBox
is not visible.
requireNotVisible
in interface StateVerificationFixture
AssertionError
- if this fixture's JComboBox
is visible.public JComboBoxFixture requireEditable()
JComboBox
is editable.
requireEditable
in interface EditableComponentFixture
AssertionError
- if this fixture's JComboBox
is not editable.public JComboBoxFixture requireNotEditable()
JComboBox
is not editable.
requireNotEditable
in interface EditableComponentFixture
AssertionError
- if this fixture's JComboBox
is editable.public JComboBoxFixture requireSelection(String value)
String
representation of the selected item in this fixture's
JComboBox
matches the given text.
requireSelection
in interface ItemGroupFixture
value
- the text to match. It can be a regular expression.
AssertionError
- if the selected item does not match the given text.cellReader(JComboBoxCellReader)
public JComboBoxFixture requireItemCount(int expected)
JComboBox
has the expected number of items
requireItemCount
in interface ItemGroupFixture
expected
- the expected number of items.
AssertionError
- if the number of items in this fixture's JComboBox
is not equal to the expected
one.public JComboBoxFixture requireSelection(Pattern pattern)
String
representation of the selected item in this fixture's
JComboBox
matches the given regular expression pattern.
requireSelection
in interface ItemGroupFixture
pattern
- the regular expression pattern to match.
NullPointerException
- if the given regular expression pattern is null
.
AssertionError
- if the selected item does not match the given regular expression pattern.cellReader(JComboBoxCellReader)
public JComboBoxFixture requireSelection(int index)
JComboBox
is equal to the given
value.
requireSelection
in interface ItemGroupFixture
index
- the expected selection index.
AssertionError
- if the selected index is not equal to the given one.public JComboBoxFixture requireNoSelection()
JComboBox
does not have any selection.
requireNoSelection
in interface ItemGroupFixture
AssertionError
- if this fixture's JComboBox
has a selection.public JComboBoxFixture requireToolTip(String expected)
JComboBox
matches the given value.
requireToolTip
in interface ToolTipDisplayFixture
expected
- the given value. It can be a regular expression.
AssertionError
- if the toolTip in this fixture's JComboBox
does not match the given value.public JComboBoxFixture requireToolTip(Pattern pattern)
JComboBox
matches the given regular expression
pattern.
requireToolTip
in interface ToolTipDisplayFixture
pattern
- the regular expression pattern to match.
NullPointerException
- if the given regular expression pattern is null
.
AssertionError
- if the toolTip in this fixture's JComboBox
does not match the given regular
expression pattern.public Object clientProperty(Object key)
JComboBox
, under the given key.
clientProperty
in interface ClientPropertyStorageFixture
key
- the key to use to retrieve the client property.
null
if the property was
not found.
NullPointerException
- if the given key is null
.public JPopupMenuFixture showPopupMenu()
JComboBox
as the invoker of the pop-up menu.
showPopupMenu
in interface JPopupMenuInvokerFixture
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.
ComponentLookupException
- if a pop-up menu cannot be found.public JPopupMenuFixture showPopupMenuAt(Point p)
JComboBox
as the invoker of the
pop-up menu.
showPopupMenuAt
in interface JPopupMenuInvokerFixture
p
- the given point where to show the pop-up menu.
IllegalStateException
- if this fixture's JComboBox
is disabled.
IllegalStateException
- if this fixture's JComboBox
is not showing on the screen.
ComponentLookupException
- if a pop-up menu cannot be found.public JComboBoxFixture cellReader(JComboBoxCellReader cellReader)
JComboBoxCellReader
to use when comparing internal values
of this fixture's JComboBox
and the values expected in a test. The default implementation to
use is BasicJComboBoxCellReader
.
cellReader
- the new JComboBoxCellValueReader
to use.
NullPointerException
- if cellReader
is null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |