S
- used to simulate "self types." For more information please read "Emulating 'self types' using Java Generics to simplify fluent API implementation."public interface ItemGroupFixture<S>
Component
s that contains or display a group of items.Modifier and Type | Method and Description |
---|---|
S |
clearSelection()
Clears the selection in this fixture's
Component . |
String[] |
contents() |
S |
requireItemCount(int expected)
Verifies that this fixture's
Component has the expected number of items |
S |
requireNoSelection()
Verifies that this fixture's
Component does not have a selection. |
S |
requireSelection(int index)
Verifies that the index of the selected item in this fixture's
Component is equal to the given value. |
S |
requireSelection(Pattern pattern)
Verifies that the value of the selected item in this fixture's
Component matches the given regular
expression pattern. |
S |
requireSelection(String value)
Verifies that the value of the selected item in this fixture's
Component matches the given value. |
S |
selectItem(int index)
Simulates a user selecting an item in this fixture's
Component . |
S |
selectItem(Pattern pattern)
Simulates a user selecting an item in this fixture's
Component . |
S |
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. |
@Nonnull String[] contents()
String
representation of the elements in this fixture's Component
.@Nonnull S clearSelection()
Component
.@Nonnull S selectItem(int index)
Component
.index
- the index of the item to select.@Nonnull S selectItem(@Nullable String value)
Component
.value
- the value of the item to select. It can be a regular expression.@Nonnull S selectItem(@Nonnull Pattern pattern)
Component
. The text of the item to select must match
the given regular expression pattern.pattern
- the regular expression pattern to match.NullPointerException
- if the given regular expression pattern is null
.@Nullable Object valueAt(int index)
Component
managed by this fixture. If the value is not meaningful, this
method will return null
.index
- the index of the item to return.null
if nothing meaningful.@Nonnull S requireSelection(@Nullable String value)
Component
matches the given value.value
- the value to match. It can be a regular expression.AssertionError
- if the selected item does not match the given value.@Nonnull S requireSelection(@Nonnull Pattern pattern)
Component
matches the given regular
expression pattern.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.@Nonnull S requireSelection(int index)
Component
is equal to the given value.index
- the expected selection index.AssertionError
- if the selection index is not equal to the given value.@Nonnull S requireNoSelection()
Component
does not have a selection.AssertionError
- if this fixture's Component
has a selection.@Nonnull S requireItemCount(int expected)
Component
has the expected number of itemsexpected
- the expected number of items.AssertionError
- if the number of items in this fixture's Component
is not equal to the expected one.Copyright © 2014–2019 AssertJ. All rights reserved.