Class SearchSpecJ<T extends com.vaadin.flow.component.Component>
- java.lang.Object
-
- com.github.mvysny.kaributesting.v10.SearchSpecJ<T>
-
public class SearchSpecJ<T extends com.vaadin.flow.component.Component> extends java.lang.ObjectA 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.StringtoString()@NotNull SearchSpecJ<T>withCaption(@Nullable java.lang.String caption)The requiredBasicUtilsKt#getCaption(Component); ifnull, 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 to0..Int.MAX_VALUE@NotNull SearchSpecJ<T>withCount(int min, int max)Expected count of matching components, defaults to0..Int.MAX_VALUE@NotNull SearchSpecJ<T>withCount(@NotNull kotlin.ranges.IntRange count)expected count of matching components, defaults to0..Int.MAX_VALUE@NotNull SearchSpecJ<T>withId(@Nullable java.lang.String id)The requiredComponent.getId(); ifnull, 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 requiredBasicUtilsKt#getPlaceholder(Component); ifnull, 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'sElement.getText()must match given text.@NotNull SearchSpecJ<T>withValue(@Nullable java.lang.Object value)The requiredHasValue.getValue().
-
-
-
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 requiredComponent.getId(); ifnull, 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 requiredBasicUtilsKt#getCaption(Component); ifnull, no particular caption is matched.- Parameters:
caption-- Returns:
- this
-
withValue
@NotNull public @NotNull SearchSpecJ<T> withValue(@Nullable @Nullable java.lang.Object value)
The requiredHasValue.getValue(). Ifnull, 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 requiredBasicUtilsKt#getPlaceholder(Component); ifnull, 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'sElement.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 to0..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 to0..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 to0..Int.MAX_VALUE- Parameters:
min- minimum count, inclusivemax- 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 properObject.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:
toStringin classjava.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 thewithCount(int)rule. The rules are matched against given component only (not against its children).
-
-