Class ServiceLoaderUtils

java.lang.Object
org.junit.platform.commons.util.ServiceLoaderUtils

@API(status=INTERNAL, since="1.11") public class ServiceLoaderUtils extends Object
Collection of utilities for working with ServiceLoader.

DISCLAIMER

These utilities are intended solely for usage within the JUnit framework itself. Any usage by external parties is not supported. Use at your own risk!

Since:
1.11
  • Method Details

    • filter

      public static <T> Stream<T> filter(ServiceLoader<T> serviceLoader, Predicate<? super Class<? extends T>> providerPredicate)
      Filters the supplied service loader using the supplied predicate.
      Type Parameters:
      T - the type of the service
      Parameters:
      serviceLoader - the service loader to be filtered
      providerPredicate - the predicate to filter the loaded services
      Returns:
      a stream of loaded services that match the predicate