ForgeExtension - xgouchet/Elmyr GitHub Wiki
class ForgeExtension : BeforeAllCallback, BeforeEachCallback, BeforeTestExecutionCallback, TestExecutionExceptionHandler, ParameterResolver, Listener
A JUnit Jupiter extension that can inject forgeries in the test class's fields/properties/method parameters (when annotated with Forgery). It can also inject a Forge instance in test methods without the need to annotate it.
See Also
Constructors
<init>
ForgeExtension()
A JUnit Jupiter extension that can inject forgeries in the test class's fields/properties/method parameters (when annotated with Forgery). It can also inject a Forge instance in test methods without the need to annotate it.
See Also
Functions
beforeAll
fun beforeAll(context: ExtensionContext): Unit
Inheritdoc
beforeEach
fun beforeEach(context: ExtensionContext): Unit
Inheritdoc
beforeTestExecution
fun beforeTestExecution(context: ExtensionContext): Unit
Inheritdoc
handleTestExecutionException
fun handleTestExecutionException(context: ExtensionContext, throwable: Throwable): Unit
Inheritdoc
onFieldInjected
fun onFieldInjected(declaringClass: Class<*>, fieldType: Type, fieldName: String, value: Any?): Unit
Inheritdoc
resolveParameter
fun resolveParameter(parameterContext: ParameterContext, extensionContext: ExtensionContext): Any?
Inheritdoc
supportsParameter
fun supportsParameter(parameterContext: ParameterContext, extensionContext: ExtensionContext): Boolean
Inheritdoc
Companion Object Functions
getForge
@JvmStatic fun getForge(context: ExtensionContext): Forge?
Retrieves the Forge stored in the given ExtensionContext global store.
Parameters
context - the current ExtensionContext.
Return the valid forge for that context or null
Companion Object Properties
EXTENSION_STORE_FORGE_KEY
val EXTENSION_STORE_FORGE_KEY: String
The key used to store the Forge in an ExtensionContext's global store.