Class SetupExtension

  • All Implemented Interfaces:
    org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource
    Direct Known Subclasses:
    PatriotSetupExtension

    public abstract class SetupExtension
    extends Object
    implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource
    Abstract class represents base for extension to JUnit which allows configuration and Test environment setup before the Test Run is started.
    • Constructor Detail

      • SetupExtension

        public SetupExtension()
    • Method Detail

      • setUp

        public abstract void setUp()
        This method is started once the implementation is instantiated by Test Runner
      • tearDown

        public abstract void tearDown()
        This method is executed when Test Run is finished to clean environment
      • getUUID

        protected abstract UUID getUUID()
        Abstract method to obtain unique identifier of the extension
        Returns:
        unique identifier
      • isSetUp

        protected abstract boolean isSetUp()
        Abstract method to signal Extension framework that setup method already run
        Returns:
        true if setup method was invoked
      • beforeAll

        public void beforeAll​(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                       throws Exception
        Specified by:
        beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallback
        Throws:
        Exception
      • close

        public void close()
                   throws Throwable
        Specified by:
        close in interface org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource
        Throws:
        Throwable