Class MockComponentContainerExtension
java.lang.Object
com.atlassian.jira.junit.extensions.MockComponentContainerExtension
- 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 MockComponentContainerExtension
extends Object
implements org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.TestInstancePostProcessor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<I,
C extends I>
MockComponentContainerBasevoid
afterEach
(org.junit.jupiter.api.extension.ExtensionContext context) void
beforeEach
(org.junit.jupiter.api.extension.ExtensionContext context) void
Find all fields on the provided object annotated withAvailableInContainer
and add them to the container.void
postProcessTestInstance
(Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context)
-
Constructor Details
-
MockComponentContainerExtension
public MockComponentContainerExtension()
-
-
Method Details
-
postProcessTestInstance
public void postProcessTestInstance(Object testInstance, org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
postProcessTestInstance
in interfaceorg.junit.jupiter.api.extension.TestInstancePostProcessor
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
beforeEach
in interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
afterEach
in interfaceorg.junit.jupiter.api.extension.AfterEachCallback
-
addMock
public <I,C extends I> MockComponentContainerBase addMock(Class<I> componentInterface, C mockComponentImplementation) -
initMocks
Find all fields on the provided object annotated withAvailableInContainer
and add them to the container. Use this method to handle fields declared in classes that are not the test class.- Parameters:
testInstance
- the test instance
-
getMockWorker
-