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
,org.junit.jupiter.api.extension.TestInstantiationAwareExtension
public class MockComponentContainerExtension
extends Object
implements org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.TestInstancePostProcessor
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension
org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope
-
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) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.junit.jupiter.api.extension.TestInstantiationAwareExtension
getTestInstantiationExtensionContextScope
-
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
-