Package org.testfx.matcher.control
Class ComboBoxMatchers
- java.lang.Object
-
- org.testfx.matcher.control.ComboBoxMatchers
-
public class ComboBoxMatchers extends java.lang.Object
TestFX matchers forComboBox
controls.Example
The following code:
will verify thatComboBox<String> fruits = new ComboBox<>(); fruits.getItems().addAll("Apple", "Banana", "Cherry"); assertThat(fruits, ComboBoxMatchers.containsExactlyItemsInOrder("Apple", "Banana", "Cherry"));
fruits
contains exactly (only) theString
's "Apple", "Banana", and "Cherry" in order.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ComboBoxMatchers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static boolean
containsExactlyItems(javafx.scene.control.ComboBox<?> comboBox, java.lang.Object... items)
static <T> org.hamcrest.Matcher<javafx.scene.control.ComboBox>
containsExactlyItems(T... items)
Creates a matcher that matches allComboBox
es that only have all of the givenitems
, regardless of the order of their appearance.private static boolean
containsExactlyItemsInOrder(javafx.scene.control.ComboBox<?> comboBox, java.lang.Object... items)
static <T> org.hamcrest.Matcher<javafx.scene.control.ComboBox>
containsExactlyItemsInOrder(T... items)
Creates a matcher that matches allComboBox
es that only have all of the givenitems
in the exact order they are given.private static boolean
containsItems(javafx.scene.control.ComboBox<?> comboBox, java.lang.Object... items)
static <T> org.hamcrest.Matcher<javafx.scene.control.ComboBox>
containsItems(T... items)
Creates a matcher that matches allComboBox
es that have all of the givenitems
, regardless of whether it also contains other items and regardless of their order of appearance.private static boolean
containsItemsInOrder(javafx.scene.control.ComboBox<?> comboBox, java.lang.Object... items)
static <T> org.hamcrest.Matcher<javafx.scene.control.ComboBox>
containsItemsInOrder(T... items)
Creates a matcher that matches allComboBox
es that have all of the givenitems
in the exact order they appear, regardless of whether it also contains other items before or after this exact sequence.private static java.lang.String
getItemsString(javafx.scene.control.ComboBox<?> comboBox)
static org.hamcrest.Matcher<javafx.scene.control.ComboBox>
hasItems(int amount)
Creates a matcher that matches allComboBox
es that have exactlyamount
items.private static <T> boolean
hasSelectedItem(javafx.scene.control.ComboBox<?> comboBox, T selection)
static <T> org.hamcrest.Matcher<javafx.scene.control.ComboBox>
hasSelectedItem(T selection)
Creates a matcher that matches allComboBox
es that have givenselection
as its selected item.private static boolean
matchSubSequenceInOrder(javafx.scene.control.ComboBox<?> comboBox, int startIndex, java.lang.Object... items)
If startIndex = 0, this method effectively matches the entire sequence.
-
-
-
Method Detail
-
hasItems
public static org.hamcrest.Matcher<javafx.scene.control.ComboBox> hasItems(int amount)
Creates a matcher that matches allComboBox
es that have exactlyamount
items.- Parameters:
amount
- the number of items the matched ComboBox's should have
-
hasSelectedItem
public static <T> org.hamcrest.Matcher<javafx.scene.control.ComboBox> hasSelectedItem(T selection)
Creates a matcher that matches allComboBox
es that have givenselection
as its selected item.- Parameters:
selection
- the selected item the matched ComboBox's should have
-
containsItems
public static <T> org.hamcrest.Matcher<javafx.scene.control.ComboBox> containsItems(T... items)
Creates a matcher that matches allComboBox
es that have all of the givenitems
, regardless of whether it also contains other items and regardless of their order of appearance.- Parameters:
items
- the items the matched ComboBox's should have
-
containsExactlyItems
public static <T> org.hamcrest.Matcher<javafx.scene.control.ComboBox> containsExactlyItems(T... items)
Creates a matcher that matches allComboBox
es that only have all of the givenitems
, regardless of the order of their appearance.- Parameters:
items
- the only items the matched ComboBox's should have
-
containsItemsInOrder
public static <T> org.hamcrest.Matcher<javafx.scene.control.ComboBox> containsItemsInOrder(T... items)
Creates a matcher that matches allComboBox
es that have all of the givenitems
in the exact order they appear, regardless of whether it also contains other items before or after this exact sequence.- Parameters:
items
- the items the matched ComboBox's should have in the same order
-
containsExactlyItemsInOrder
public static <T> org.hamcrest.Matcher<javafx.scene.control.ComboBox> containsExactlyItemsInOrder(T... items)
Creates a matcher that matches allComboBox
es that only have all of the givenitems
in the exact order they are given.- Parameters:
items
- the only items the matched ComboBox's should have in the same order
-
hasSelectedItem
private static <T> boolean hasSelectedItem(javafx.scene.control.ComboBox<?> comboBox, T selection)
-
containsItems
private static boolean containsItems(javafx.scene.control.ComboBox<?> comboBox, java.lang.Object... items)
-
containsExactlyItems
private static boolean containsExactlyItems(javafx.scene.control.ComboBox<?> comboBox, java.lang.Object... items)
-
containsItemsInOrder
private static boolean containsItemsInOrder(javafx.scene.control.ComboBox<?> comboBox, java.lang.Object... items)
-
containsExactlyItemsInOrder
private static boolean containsExactlyItemsInOrder(javafx.scene.control.ComboBox<?> comboBox, java.lang.Object... items)
-
matchSubSequenceInOrder
private static boolean matchSubSequenceInOrder(javafx.scene.control.ComboBox<?> comboBox, int startIndex, java.lang.Object... items)
If startIndex = 0, this method effectively matches the entire sequence.
-
getItemsString
private static java.lang.String getItemsString(javafx.scene.control.ComboBox<?> comboBox)
-
-