Class ModuleUtils

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

@API(status=INTERNAL, since="1.1") public class ModuleUtils extends Object
Collection of utilities for working with java.lang.Module and friends.

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.1
  • Constructor Details

    • ModuleUtils

      public ModuleUtils()
  • Method Details

    • findAllNonSystemBootModuleNames

      public static Set<String> findAllNonSystemBootModuleNames()
      Find all non-system boot modules names.
      Returns:
      a set of all such module names; never null but potentially empty
    • isJavaPlatformModuleSystemAvailable

      public static boolean isJavaPlatformModuleSystemAvailable()
      Java 9+ runtime supports the Java Platform Module System.
      Returns:
      true
    • getModuleName

      public static Optional<String> getModuleName(Class<?> type)
    • getModuleVersion

      public static Optional<String> getModuleVersion(Class<?> type)
    • findAllClassesInModule

      public static List<Class<?>> findAllClassesInModule(String moduleName, ClassFilter filter)
      Find all classes for the given module name.
      Parameters:
      moduleName - the name of the module to scan; never null or empty
      filter - the class filter to apply; never null
      Returns:
      an immutable list of all such classes found; never null but potentially empty
    • findAllResourcesInModule

      @API(status=INTERNAL, since="1.11") public static List<Resource> findAllResourcesInModule(String moduleName, Predicate<Resource> filter)
      Find all resources for the given module name.
      Parameters:
      moduleName - the name of the module to scan; never null or empty
      filter - the class filter to apply; never null
      Returns:
      an immutable list of all such resources found; never null but potentially empty
      Since:
      1.11