Module org.testfx

Class AbstractComboBoxAssert<SELF extends AbstractComboBoxAssert<SELF,​T>,​T>

  • All Implemented Interfaces:
    org.assertj.core.api.Assert<SELF,​javafx.css.Styleable>, org.assertj.core.api.Descriptable<SELF>, org.assertj.core.api.ExtensionPoints<SELF,​javafx.css.Styleable>
    Direct Known Subclasses:
    ComboBoxAssert

    public class AbstractComboBoxAssert<SELF extends AbstractComboBoxAssert<SELF,​T>,​T>
    extends AbstractNodeAssert<SELF>
    Assertion methods for ComboBox type.

    To create an instance of this class, invoke Assertions.assertThat(ComboBox).

    Example

    The following code:
    
       ComboBox<String> fruits = new ComboBox<>();
       fruits.getItems().addAll("Apple", "Banana", "Cherry");
       assertThat(fruits).containsExactlyItemsInOrder("Apple", "Banana", "Cherry");
     
    will assert that fruits contains exactly (only) the String's "Apple", "Banana", and "Cherry" in order.
    • Constructor Detail

      • AbstractComboBoxAssert

        protected AbstractComboBoxAssert​(javafx.scene.control.ComboBox<T> actual,
                                         Class<?> selfType)
    • Method Detail

      • hasExactlyNumItems

        public SELF hasExactlyNumItems​(int amount)
        Verifies that the actual ComboBox has exactly the given amount of items.
        Parameters:
        amount - the given amount of items to compare the actual amount of items to
        Returns:
        this assertion object
      • doesNotHaveExactlyNumItems

        public SELF doesNotHaveExactlyNumItems​(int amount)
        Verifies that the actual ComboBox does not have exactly the given amount of items.
        Parameters:
        amount - the given amount of items to compare the actual amount of items to
        Returns:
        this assertion object
      • hasSelectedItem

        public SELF hasSelectedItem​(T selection)
        Verifies that the actual ComboBox has the given selection as its' selected item.
        Parameters:
        selection - the given selection to compare the actual selected item to
        Returns:
        this assertion object
      • doesNotHaveSelectedItem

        public SELF doesNotHaveSelectedItem​(T selection)
        Verifies that the actual ComboBox does not have the given selection as its' selected item.
        Parameters:
        selection - the given selection to compare the actual selected item to
        Returns:
        this assertion object
      • containsItems

        public SELF containsItems​(T... items)
        Verifies that the actual ComboBox contains at least the given items in any order.
        Parameters:
        items - the given items to ensure are at least contained in the ComboBox in any order
        Returns:
        this assertion object
      • containsExactlyItems

        public SELF containsExactlyItems​(T... items)
        Verifies that the actual ComboBox contains exactly the given items in any order.
        Parameters:
        items - the given items to ensure are the only ones contained in the ComboBox in any order
        Returns:
        this assertion object
      • containsItemsInOrder

        public SELF containsItemsInOrder​(T... items)
        Verifies that the actual ComboBox contains at least the given items in order.
        Parameters:
        items - the given items to ensure are at least contained in the ComboBox in order
        Returns:
        this assertion object
      • containsExactlyItemsInOrder

        public SELF containsExactlyItemsInOrder​(T... items)
        Verifies that the actual ComboBox contains exactly the given items in order.
        Parameters:
        items - the given items to ensure are the only ones contained in the ComboBox in order
        Returns:
        this assertion object