Package de.ppi.deepsampler.junit5
Class DeepSamplerExtension
java.lang.Object
de.ppi.deepsampler.junit5.DeepSamplerExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterEachCallback,org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension,org.junit.jupiter.api.extension.TestInstancePostProcessor
public class DeepSamplerExtension
extends java.lang.Object
implements org.junit.jupiter.api.extension.TestInstancePostProcessor, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
As a convenient alternative, Samplers may be prepared by annotating properties in test classes with
PrepareSampler instead of using
Sampler.prepare(Class). In Junit5 the annotation is interpreted by this JUnit Extension.
The Extension also clears Samplers that might have been created by preceding tests before a new test method is started.
This would otherwise have to be done by calling Sampler.clear() manually in each test.
The Extension is enabled by annotation a test class with @ExtendWith(DeepSamplerExtension.class)
-
Constructor Summary
Constructors Constructor Description DeepSamplerExtension() -
Method Summary
Modifier and Type Method Description voidafterEach(org.junit.jupiter.api.extension.ExtensionContext context)voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context)voidpostProcessTestInstance(java.lang.Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context)
-
Constructor Details
-
DeepSamplerExtension
public DeepSamplerExtension()
-
-
Method Details
-
postProcessTestInstance
public void postProcessTestInstance(java.lang.Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context)- Specified by:
postProcessTestInstancein interfaceorg.junit.jupiter.api.extension.TestInstancePostProcessor
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context)- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context)- Specified by:
afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback
-