Class JGivenExtension

  • All Implemented Interfaces:
    org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.TestInstancePostProcessor

    public class JGivenExtension
    extends java.lang.Object
    implements org.junit.jupiter.api.extension.TestInstancePostProcessor, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
    This extension enables JGiven for JUnit 5 Tests.

    Just annotate your test class with @ExtendWith( JGivenExtension.class )

    You can then inject stage classes by using the {@see ScenarioStage} annotation

    As an alternative you can also inherit from one of the following predefined base classes:

    See Also:
    ScenarioTest, SimpleScenarioTest
    • Constructor Summary

      Constructors 
      Constructor Description
      JGivenExtension()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterAll​(org.junit.jupiter.api.extension.ExtensionContext context)  
      void afterEach​(org.junit.jupiter.api.extension.ExtensionContext context)  
      void beforeAll​(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 Detail

      • JGivenExtension

        public JGivenExtension()
    • Method Detail

      • beforeAll

        public void beforeAll​(org.junit.jupiter.api.extension.ExtensionContext context)
                       throws java.lang.Exception
        Specified by:
        beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallback
        Throws:
        java.lang.Exception
      • afterAll

        public void afterAll​(org.junit.jupiter.api.extension.ExtensionContext context)
                      throws java.lang.Exception
        Specified by:
        afterAll in interface org.junit.jupiter.api.extension.AfterAllCallback
        Throws:
        java.lang.Exception
      • beforeEach

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

        public void afterEach​(org.junit.jupiter.api.extension.ExtensionContext context)
                       throws java.lang.Exception
        Specified by:
        afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback
        Throws:
        java.lang.Exception
      • postProcessTestInstance

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