Class AbstractUIUnitTest.QueryResult<T extends com.vaadin.server.ClientConnector>

java.lang.Object
java.util.AbstractCollection<T>
java.util.AbstractList<T>
java.util.ArrayList<T>
com.vaadin.testbench.uiunittest.AbstractUIUnitTest.QueryResult<T>
Type Parameters:
T - Component type
All Implemented Interfaces:
Serializable, Cloneable, Iterable<T>, Collection<T>, List<T>, RandomAccess, SequencedCollection<T>
Enclosing class:
AbstractUIUnitTest

public static class AbstractUIUnitTest.QueryResult<T extends com.vaadin.server.ClientConnector> extends ArrayList<T>
Result type for component searches.
See Also:
  • Constructor Details

    • QueryResult

      public QueryResult(Collection<T> list)
    • QueryResult

      public QueryResult()
  • Method Details

    • id

      public T id(String id)
      Find the component by id using exact match. Returns the first matching component by id within the search results assuming ids are unique.
      Parameters:
      id - The id as String
      Returns:
      Component instance, can be null
      Throws:
      AssertionError - if more than one component is found with the given id
    • styleName

      public AbstractUIUnitTest.QueryResult<T> styleName(String styleName)
      Find components by matching style name, using partial matching. Result can contain many components.
      Parameters:
      styleName - Style name as String
      Returns:
      Result set of components
    • caption

      public AbstractUIUnitTest.QueryResult<T> caption(String caption)
      Find components by matching caption, using partial matching. Result can contain many components.
      Parameters:
      caption - Caption as String
      Returns:
      Result set of components
    • first

      public T first()
      Return the first component in the list.

      Note, if you assume there is only one component, use single() method.

      Returns:
      Component, null if the list was empty.
    • last

      public T last()
      Return the last component in the list.
      Returns:
      Component, null if the list was empty.
    • single

      public T single()
      Return the only component in the list if it exists, otherwise fail with assertion.
      Returns:
      Component.