Top Description Methods
org.junit.platform.engine

public Interface Filter<T>

Known Direct Subinterfaces
org.junit.platform.engine.DiscoveryFilter
Known Direct Implementers
org.junit.platform.engine.CompositeFilter
Annotations
@FunctionalInterface
@API
status:STABLE
since:1.0
Static Imports
java.util.Arrays.asList, org.apiguardian.api.API.Status.DEPRECATED, .API.Status.STABLE, org.junit.platform.commons.util.CollectionUtils.getOnlyElement, org.junit.platform.engine.CompositeFilter.alwaysIncluded

A Filter 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

Modifier and TypeMethod and Description
public static <T, V> Filter<T>
adaptFilter(Filter<V>
the filter to be adapted
adaptee
,
Function<T, V>
the converter function to apply
converter
)
Deprecated for removal since 6.0. without replacement

Return a filter that will include elements if and only if the adapted Filter includes the value converted using the supplied Function.

public FilterResult
apply(T object)

Apply this filter to the supplied object.

public static <T> Filter<T>
composeFilters(Filter<T>...
the array of filters to compose; never null
filters
)

Return a filter that will include elements if and only if all of the filters in the supplied array of filters include it.

public static <T> Filter<T>
composeFilters(Collection<? extends Filter<T>>
the collection of filters to compose; never null
filters
)

Return a filter that will include elements if and only if all of the filters in the supplied collection of filters include it.

public default Predicate<T>
toPredicate()

Return a Predicate that returns true if this filter includes the object supplied to the predicate's test method.

Method Detail

adaptFilterback to summary
public static <T, V> Filter<T> adaptFilter(Filter<V> adaptee, Function<T, V> converter)

Deprecated

for removal since 6.0.

without replacement

Return a filter that will include elements if and only if the adapted Filter includes the value converted using the supplied Function.

Parameters
adaptee:Filter<V>

the filter to be adapted

converter:Function<T, V>

the converter function to apply

Annotations
@API
status:DEPRECATED
since:6.0
@Deprecated
since:6.0
forRemoval:true
applyback to summary
public FilterResult apply(T object)

Apply this filter to the supplied object.

composeFiltersback to summary
public 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 of filters include it.

If the array is empty, the returned filter will include all elements it is asked to filter.

Parameters
filters:Filter<T>[]

the array of filters to compose; never null

Annotations
@SafeVarargs
@SuppressWarnings:varargs
See Also
composeFilters(Collection)
composeFiltersback to summary
public static <T> Filter<T> composeFilters(Collection<? extends Filter<T>> filters)

Return a filter that will include elements if and only if all of the filters in the supplied collection of filters include it.

If the collection is empty, the returned filter will include all elements it is asked to filter.

Parameters
filters:Collection<? extends Filter<T>>

the collection of filters to compose; never null

See Also
composeFilters(Filter...)
toPredicateback to summary
public default Predicate<T> toPredicate()

Return a Predicate that returns true if this filter includes the object supplied to the predicate's test method.