Package org.opentestfactory.utils
Class ListOf<T>
java.lang.Object
org.opentestfactory.utils.ListOf<T>
- Type Parameters:
T- the element type.
List wrapper to add filtering and extraction functions to lists.
- Author:
- jthebault
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionattributeMatchAny(Function<T, A> getter, Collection<A> matchingValues) Get all list elements which value for the target attribute is in the given list.attributeMatchUndefined(Function<T, A> getter) Get all list elements where the attribute isnull.attributeMatchValue(Function<T, A> getter, A matchingValue) Get all list elements with the given (non null) value for an attribute retrieved through the provided getter.booleaninthashCode()<A> List<A> toList()
-
Constructor Details
-
ListOf
-
-
Method Details
-
attributeMatchValue
Get all list elements with the given (non null) value for an attribute retrieved through the provided getter.- Type Parameters:
A- type of the target attribute.- Parameters:
getter- the member function of list element typeTthat returns the target attribute.matchingValue- the target attribute value.nullvalues triggerNullPointerException. To select for undefined attributes, useattributeMatchUndefined(Function)- Returns:
- a
ListOfinstance containing all elements where the target attribute matches the required value.
-
attributeMatchUndefined
Get all list elements where the attribute isnull.- Type Parameters:
A- type of the target attribute.- Parameters:
getter- accessor for the target attribute.- Returns:
- a
ListOfinstance containing all elements where the target attribute value is undefined (nullvalue)
-
attributeMatchAny
Get all list elements which value for the target attribute is in the given list.- Type Parameters:
A- type of the target attribute.- Parameters:
getter- accessor for the target attribute.matchingValues- a collection containing all desired attribute values. If the collection allows for null elements, they may be used (and select list elements for which the target attribute is null).NB : switch this class to the
tracelog level of you suspect thatnullvalues get unduly excluded by a non-null tolerant matchingValues collection in your test case.- Returns:
- a
ListOfinstance containing all elements where the target attribute matches one of the elements in matchingValues.
-
pluck
-
toList
-
equals
-
hashCode
public int hashCode()
-