Class ExtensionUtils
java.lang.Object
org.junit.jupiter.engine.descriptor.ExtensionUtils
Collection of utilities for working with extensions and the extension registry.
- Since:
- 5.1
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int(package private) static MutableExtensionRegistrypopulateNewExtensionRegistryFromExtendWithAnnotation(MutableExtensionRegistry parentRegistry, AnnotatedElement annotatedElement) Populate a newMutableExtensionRegistryfrom extension types declared via@ExtendWithon the suppliedAnnotatedElement.private static org.junit.jupiter.api.extension.ExtensionreadAndValidateExtensionFromField(Field field, Object instance, List<Class<? extends org.junit.jupiter.api.extension.Extension>> declarativeExtensionTypes) (package private) static voidregisterExtensionsFromConstructorParameters(ExtensionRegistrar registrar, Class<?> clazz) Register extensions using the supplied registrar from parameters in the declared constructor of the supplied class that are annotated with@ExtendWith.(package private) static voidregisterExtensionsFromExecutableParameters(ExtensionRegistrar registrar, Executable executable) Register extensions using the supplied registrar from parameters in the suppliedExecutable(i.e., aConstructororMethod) that are annotated with@ExtendWith.(package private) static voidregisterExtensionsFromInstanceFields(ExtensionRegistrar registrar, Class<?> clazz) Register extensions using the supplied registrar from instance fields in the supplied class that are annotated with@ExtendWithor@RegisterExtension.(package private) static voidregisterExtensionsFromStaticFields(ExtensionRegistrar registrar, Class<?> clazz) Register extensions using the supplied registrar from static fields in the supplied class that are annotated with@ExtendWithor@RegisterExtension.streamDeclarativeExtensionTypes(AnnotatedElement annotatedElement) streamDeclarativeExtensionTypes(List<org.junit.jupiter.api.extension.ExtendWith> extendWithAnnotations) streamExtensionRegisteringFields(Class<?> clazz, Predicate<Field> predicate)
-
Field Details
-
orderComparator
- Since:
- 5.4
-
registersExtension
-
-
Constructor Details
-
ExtensionUtils
private ExtensionUtils()
-
-
Method Details
-
populateNewExtensionRegistryFromExtendWithAnnotation
static MutableExtensionRegistry populateNewExtensionRegistryFromExtendWithAnnotation(MutableExtensionRegistry parentRegistry, AnnotatedElement annotatedElement) Populate a newMutableExtensionRegistryfrom extension types declared via@ExtendWithon the suppliedAnnotatedElement.- Parameters:
parentRegistry- the parent extension registry to set in the newly created registry; nevernullannotatedElement- the annotated element on which to search for declarations of@ExtendWith; nevernull- Returns:
- the new extension registry; never
null - Since:
- 5.0
-
registerExtensionsFromStaticFields
Register extensions using the supplied registrar from static fields in the supplied class that are annotated with@ExtendWithor@RegisterExtension.The extensions will be sorted according to
@Ordersemantics prior to registration.- Parameters:
registrar- the registrar with which to register the extensions; nevernullclazz- the class or interface in which to find the fields; nevernull- Since:
- 5.11
-
registerExtensionsFromInstanceFields
Register extensions using the supplied registrar from instance fields in the supplied class that are annotated with@ExtendWithor@RegisterExtension.The extensions will be sorted according to
@Ordersemantics prior to registration.- Parameters:
registrar- the registrar with which to register the extensions; nevernullclazz- the class or interface in which to find the fields; nevernull- Since:
- 5.11
-
readAndValidateExtensionFromField
-
registerExtensionsFromConstructorParameters
static void registerExtensionsFromConstructorParameters(ExtensionRegistrar registrar, Class<?> clazz) Register extensions using the supplied registrar from parameters in the declared constructor of the supplied class that are annotated with@ExtendWith.- Parameters:
registrar- the registrar with which to register the extensions; nevernullclazz- the class in which to find the declared constructor; nevernull- Since:
- 5.8
-
registerExtensionsFromExecutableParameters
static void registerExtensionsFromExecutableParameters(ExtensionRegistrar registrar, Executable executable) Register extensions using the supplied registrar from parameters in the suppliedExecutable(i.e., aConstructororMethod) that are annotated with@ExtendWith.- Parameters:
registrar- the registrar with which to register the extensions; nevernullexecutable- the constructor or method whose parameters should be searched; nevernull- Since:
- 5.8
-
streamExtensionRegisteringFields
-
streamDeclarativeExtensionTypes
private static Stream<Class<? extends org.junit.jupiter.api.extension.Extension>> streamDeclarativeExtensionTypes(AnnotatedElement annotatedElement) - Since:
- 5.11
-
streamDeclarativeExtensionTypes
-
getOrder
- Since:
- 5.4
-