Class SearchSpecJ<T extends com.vaadin.flow.component.Component>


  • public class SearchSpecJ<T extends com.vaadin.flow.component.Component>
    extends java.lang.Object
    A criterion for matching components. The component must match all of non-null fields.
    • Constructor Summary

      Constructors 
      Constructor Description
      SearchSpecJ​(@NotNull com.github.mvysny.kaributesting.v10.SearchSpec<T> spec)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @NotNull java.util.function.Predicate<com.vaadin.flow.component.Component> toPredicate()
      Returns a predicate which matches components based on this spec.
      java.lang.String toString()  
      @NotNull SearchSpecJ<T> withCaption​(@Nullable java.lang.String caption)
      The required BasicUtilsKt#getCaption(Component); if null, no particular caption is matched.
      @NotNull SearchSpecJ<T> withClasses​(@Nullable java.lang.String classes)
      If not null, the component must match all of these classes.
      @NotNull SearchSpecJ<T> withCount​(int count)
      Expected count of matching components, defaults to 0..Int.MAX_VALUE
      @NotNull SearchSpecJ<T> withCount​(int min, int max)
      Expected count of matching components, defaults to 0..Int.MAX_VALUE
      @NotNull SearchSpecJ<T> withCount​(@NotNull kotlin.ranges.IntRange count)
      expected count of matching components, defaults to 0..Int.MAX_VALUE
      @NotNull SearchSpecJ<T> withId​(@Nullable java.lang.String id)
      The required Component.getId(); if null, no particular id is matched.
      @NotNull SearchSpecJ<T> withoutClasses​(@Nullable java.lang.String classes)
      If not null, the component must NOT match any of these classes.
      @NotNull SearchSpecJ<T> withPlaceholder​(@Nullable java.lang.String placeholder)
      The required BasicUtilsKt#getPlaceholder(Component); if null, no particular placeholder is matched.
      @NotNull SearchSpecJ<T> withPredicate​(@NotNull java.util.function.Predicate<T> predicate)
      Adds an additional predicate which the component needs to match.
      @NotNull SearchSpecJ<T> withText​(@Nullable java.lang.String text)
      if not null, the component's Element.getText() must match given text.
      @NotNull SearchSpecJ<T> withValue​(@Nullable java.lang.Object value)
      The required HasValue.getValue().
      • Methods inherited from class java.lang.Object

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

      • SearchSpecJ

        public SearchSpecJ​(@NotNull
                           @NotNull com.github.mvysny.kaributesting.v10.SearchSpec<T> spec)
    • Method Detail

      • withId

        @NotNull
        public @NotNull SearchSpecJ<T> withId​(@Nullable
                                              @Nullable java.lang.String id)
        The required Component.getId(); if null, no particular id is matched.
        Parameters:
        id - the id
        Returns:
        this
      • withCaption

        @NotNull
        public @NotNull SearchSpecJ<T> withCaption​(@Nullable
                                                   @Nullable java.lang.String caption)
        The required BasicUtilsKt#getCaption(Component); if null, no particular caption is matched.
        Parameters:
        caption -
        Returns:
        this
      • withValue

        @NotNull
        public @NotNull SearchSpecJ<T> withValue​(@Nullable
                                                 @Nullable java.lang.Object value)
        The required HasValue.getValue(). If null, no particular value is matched.
        Parameters:
        value - the expected value
        Returns:
        this
      • withPlaceholder

        @NotNull
        public @NotNull SearchSpecJ<T> withPlaceholder​(@Nullable
                                                       @Nullable java.lang.String placeholder)
        The required BasicUtilsKt#getPlaceholder(Component); if null, no particular placeholder is matched.
        Parameters:
        placeholder - the placeholder
        Returns:
        this
      • withText

        @NotNull
        public @NotNull SearchSpecJ<T> withText​(@Nullable
                                                @Nullable java.lang.String text)
        if not null, the component's Element.getText() must match given text.
        Parameters:
        text - the expected text
        Returns:
        this
      • withCount

        @NotNull
        public @NotNull SearchSpecJ<T> withCount​(@NotNull
                                                 @NotNull kotlin.ranges.IntRange count)
        expected count of matching components, defaults to 0..Int.MAX_VALUE
        Parameters:
        count - expected count of matching components. Any count of component within this range is accepted.
        Returns:
        this
      • withCount

        @NotNull
        public @NotNull SearchSpecJ<T> withCount​(int count)
        Expected count of matching components, defaults to 0..Int.MAX_VALUE
        Parameters:
        count - expected count
        Returns:
        this
      • withCount

        @NotNull
        public @NotNull SearchSpecJ<T> withCount​(int min,
                                                 int max)
        Expected count of matching components, defaults to 0..Int.MAX_VALUE
        Parameters:
        min - minimum count, inclusive
        max - maximum count, inclusive
        Returns:
        this
      • withClasses

        @NotNull
        public @NotNull SearchSpecJ<T> withClasses​(@Nullable
                                                   @Nullable java.lang.String classes)
        If not null, the component must match all of these classes. Space-separated.
        Parameters:
        classes - expected space-separated classes.
        Returns:
        this
      • withoutClasses

        @NotNull
        public @NotNull SearchSpecJ<T> withoutClasses​(@Nullable
                                                      @Nullable java.lang.String classes)
        If not null, the component must NOT match any of these classes. Space-separated.
        Parameters:
        classes - space-separated classes, neither of which must be present on the component.
        Returns:
        this
      • withPredicate

        @NotNull
        public @NotNull SearchSpecJ<T> withPredicate​(@NotNull
                                                     @NotNull java.util.function.Predicate<T> predicate)
        Adds an additional predicate which the component needs to match. Not null.

        Please remember to provide a proper Object.toString() for the predicate, so that you'll get an informative error message on lookup failure.

        Parameters:
        predicate - the matcher
        Returns:
        this
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toPredicate

        @NotNull
        public @NotNull java.util.function.Predicate<com.vaadin.flow.component.Component> toPredicate()
        Returns a predicate which matches components based on this spec. All rules are matched, except the withCount(int) rule. The rules are matched against given component only (not against its children).