Class ComponentTester

  • All Implemented Interfaces:

    
    public class ComponentTester<T extends Component>
    
                        

    Test wrapper for components with helpful methods for testing a component.

    More targeted methods for specific components exist in named component wrappers.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final T component
    • Constructor Summary

      Constructors 
      Constructor Description
      ComponentTester(T component) Wrap given component for testing.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      T getComponent() Get the wrapped component.
      boolean isUsable() Validate that component can be interacted with and should be visible in the UI.
      void setModal(boolean modal) Set component modality.
      <R extends Component> ComponentQuery<R> find(Class<R> componentType) Gets a ComponentQuery to search for component of the given type nested inside the wrapped component.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ComponentTester

        ComponentTester(T component)
        Wrap given component for testing.
        Parameters:
        component - target component
    • Method Detail

      • getComponent

         T getComponent()

        Get the wrapped component.

        Returns:

        wrapped component

      • isUsable

         boolean isUsable()

        Validate that component can be interacted with and should be visible in the UI. Subclasses overriding this method should also override notUsableReasons to provide additional details to the potential exception thrown by ensureComponentIsUsable.

        Returns:

        true if component can be interacted with by the user

      • setModal

         void setModal(boolean modal)

        Set component modality.

        Automatically generates a client side change to propagate modality.

        Parameters:
        modal - true to make component modal, false to remove modality
      • find

         <R extends Component> ComponentQuery<R> find(Class<R> componentType)

        Gets a ComponentQuery to search for component of the given type nested inside the wrapped component.

        Parameters:
        componentType - type of the component to search.
        Returns:

        a ComponentQuery instance, searching for wrapped component children.