Package org.junit.platform.engine
Interface Filter<T>
-
- All Known Subinterfaces:
ClassNameFilter
,DiscoveryFilter<T>
,PackageNameFilter
,PostDiscoveryFilter
- All Known Implementing Classes:
EngineFilter
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface @API(status=STABLE, since="1.0") public interface Filter<T>
AFilter
can be applied to determine if an object should be included or excluded in a result set.For example, tests may be filtered during or after test discovery based on certain criteria.
Clients should not implement this interface directly but rather one of its subinterfaces.
- Since:
- 1.0
- See Also:
DiscoveryFilter
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static <T,V> Filter<T>
adaptFilter(Filter<V> adaptee, java.util.function.Function<T,V> converter)
Return a filter that will include elements if and only if the adaptedFilter
includes the value converted using the suppliedFunction
.FilterResult
apply(T object)
Apply this filter to the supplied object.static <T> Filter<T>
composeFilters(java.util.Collection<? extends Filter<T>> filters)
Return a filter that will include elements if and only if all of the filters in the supplied collection offilters
include it.static <T> Filter<T>
composeFilters(Filter<T>... filters)
Return a filter that will include elements if and only if all of the filters in the supplied array offilters
include it.default java.util.function.Predicate<T>
toPredicate()
Return aPredicate
that returnstrue
if this filter includes the object supplied to the predicate'stest
method.
-
-
-
Method Detail
-
composeFilters
@SafeVarargs static <T> Filter<T> composeFilters(Filter<T>... filters)
Return a filter that will include elements if and only if all of the filters in the supplied array offilters
include it.If the array is empty, the returned filter will include all elements it is asked to filter.
- Parameters:
filters
- the array of filters to compose; nevernull
- See Also:
composeFilters(Collection)
-
composeFilters
static <T> Filter<T> composeFilters(java.util.Collection<? extends Filter<T>> filters)
Return a filter that will include elements if and only if all of the filters in the supplied collection offilters
include it.If the collection is empty, the returned filter will include all elements it is asked to filter.
- Parameters:
filters
- the collection of filters to compose; nevernull
- See Also:
composeFilters(Filter...)
-
adaptFilter
static <T,V> Filter<T> adaptFilter(Filter<V> adaptee, java.util.function.Function<T,V> converter)
Return a filter that will include elements if and only if the adaptedFilter
includes the value converted using the suppliedFunction
.- Parameters:
adaptee
- the filter to be adaptedconverter
- the converter function to apply
-
apply
FilterResult apply(T object)
Apply this filter to the supplied object.
-
toPredicate
default java.util.function.Predicate<T> toPredicate()
Return aPredicate
that returnstrue
if this filter includes the object supplied to the predicate'stest
method.
-
-