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
    void afterEach​(org.junit.jupiter.api.extension.ExtensionContext context)  
    void beforeEach​(org.junit.jupiter.api.extension.ExtensionContext context)  
    void postProcessTestInstance​(java.lang.Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • postProcessTestInstance

      public void postProcessTestInstance​(java.lang.Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context)
      Specified by:
      postProcessTestInstance in interface org.junit.jupiter.api.extension.TestInstancePostProcessor
    • beforeEach

      public void beforeEach​(org.junit.jupiter.api.extension.ExtensionContext context)
      Specified by:
      beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallback
    • afterEach

      public void afterEach​(org.junit.jupiter.api.extension.ExtensionContext context)
      Specified by:
      afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback