Class AbstractAllOrEachExtension
java.lang.Object
com.linecorp.armeria.testing.junit5.common.AbstractAllOrEachExtension
- All Implemented Interfaces:
AfterAllCallback,AfterEachCallback,BeforeAllCallback,BeforeEachCallback,Extension
- Direct Known Subclasses:
EventLoopExtension,EventLoopGroupExtension,SelfSignedCertificateExtension,ServerExtension
public abstract class AbstractAllOrEachExtension
extends Object
implements BeforeAllCallback, AfterAllCallback, BeforeEachCallback, AfterEachCallback
A base class for JUnit5 extensions that allows implementations to control whether the callbacks are run
around the entire class, like
BeforeAll or AfterAll, or around each test method, like
BeforeEach or AfterEach. By default, the extension will run around the entire class -
implementations that want to run around each test method instead should override
runForEachTest().-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidafter(ExtensionContext context) A method that should be run at the end of a test lifecycle.final voidafterAll(ExtensionContext context) voidafterEach(ExtensionContext context) protected abstract voidbefore(ExtensionContext context) A method that should be run at the beginning of a test lifecycle.final voidbeforeAll(ExtensionContext context) voidbeforeEach(ExtensionContext context) protected booleanReturns whether this extension should run around each test method instead of the entire test class.
-
Constructor Details
-
AbstractAllOrEachExtension
public AbstractAllOrEachExtension()
-
-
Method Details
-
before
A method that should be run at the beginning of a test lifecycle. IfrunForEachTest()returnsfalse, this is run once before all tests, otherwise it is run before each test method.- Throws:
Exception
-
after
A method that should be run at the end of a test lifecycle. IfrunForEachTest()returnsfalse, this is run once after all tests, otherwise it is run after each test method.- Throws:
Exception
-
beforeAll
- Specified by:
beforeAllin interfaceBeforeAllCallback- Throws:
Exception
-
afterAll
- Specified by:
afterAllin interfaceAfterAllCallback- Throws:
Exception
-
beforeEach
- Specified by:
beforeEachin interfaceBeforeEachCallback- Throws:
Exception
-
afterEach
- Specified by:
afterEachin interfaceAfterEachCallback- Throws:
Exception
-
runForEachTest
protected boolean runForEachTest()Returns whether this extension should run around each test method instead of the entire test class. Implementations should override this method to returntrueto run around each test method.
-