Class TestWithResourcesExtension
java.lang.Object
com.adelean.inject.resources.junit.jupiter.TestWithResourcesExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.BeforeAllCallback,org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension,org.junit.jupiter.api.extension.ParameterResolver
public class TestWithResourcesExtension
extends java.lang.Object
implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.ParameterResolver
-
Constructor Summary
Constructors Constructor Description TestWithResourcesExtension() -
Method Summary
Modifier and Type Method Description voidbeforeAll(org.junit.jupiter.api.extension.ExtensionContext context)Performs field injection for non-private,staticfields (i.e., class fields) that are annotated with one ofGiven*Resourceannotation with content of resource file.voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context)Performs field injection for non-private, non-static fields (i.e., instance fields) that are annotated with one ofGiven*Resourceannotation with content of resource file.java.lang.ObjectresolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)Injects the resource intoParameterin the suppliedParameterContext.booleansupportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)Determines if theParameterin the suppliedParameterContextis annotated with one ofGiven*Resourceannotation.
-
Constructor Details
-
TestWithResourcesExtension
public TestWithResourcesExtension()
-
-
Method Details
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)Performs field injection for non-private,staticfields (i.e., class fields) that are annotated with one ofGiven*Resourceannotation with content of resource file.- Specified by:
beforeAllin interfaceorg.junit.jupiter.api.extension.BeforeAllCallback
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context)Performs field injection for non-private, non-static fields (i.e., instance fields) that are annotated with one ofGiven*Resourceannotation with content of resource file.- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
supportsParameter
public boolean supportsParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionExceptionDetermines if theParameterin the suppliedParameterContextis annotated with one ofGiven*Resourceannotation.- Specified by:
supportsParameterin interfaceorg.junit.jupiter.api.extension.ParameterResolver- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-
resolveParameter
public java.lang.Object resolveParameter(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext) throws org.junit.jupiter.api.extension.ParameterResolutionExceptionInjects the resource intoParameterin the suppliedParameterContext.- Specified by:
resolveParameterin interfaceorg.junit.jupiter.api.extension.ParameterResolver- Throws:
org.junit.jupiter.api.extension.ParameterResolutionException
-