Class KubernetesMockServerExtension
- java.lang.Object
-
- io.fabric8.kubernetes.client.server.mock.KubernetesMockServerExtension
-
- 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
public class KubernetesMockServerExtension extends Object implements org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.BeforeAllCallback
The class that implements JUnit5 extension mechanism. You can use it directly in your JUnit test by annotating it with@ExtendWith(KubernetesMockExtension.class)
or through@EnableKubernetesMock
annotation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
KubernetesMockServerExtension.SetTestClassField
-
Constructor Summary
Constructors Constructor Description KubernetesMockServerExtension()
-
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)
protected void
destroy()
protected void
destroyStatic()
protected Class<?>
getKubernetesMockServerType()
protected void
initializeKubernetesClientAndMockServer(Class<?> testClass, boolean isStatic)
protected void
setFieldIfEqualsToProvidedType(org.junit.jupiter.api.extension.ExtensionContext context, boolean isStatic, Field field, Class<?> fieldType, KubernetesMockServerExtension.SetTestClassField setTestClassField)
protected void
setFieldIfKubernetesClientOrMockServer(org.junit.jupiter.api.extension.ExtensionContext context, boolean isStatic, Field field)
-
-
-
Method Detail
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
afterEach
in interfaceorg.junit.jupiter.api.extension.AfterEachCallback
-
afterAll
public void afterAll(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
afterAll
in interfaceorg.junit.jupiter.api.extension.AfterAllCallback
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
- Specified by:
beforeEach
in interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
- Throws:
Exception
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
- Specified by:
beforeAll
in interfaceorg.junit.jupiter.api.extension.BeforeAllCallback
- Throws:
Exception
-
setFieldIfKubernetesClientOrMockServer
protected void setFieldIfKubernetesClientOrMockServer(org.junit.jupiter.api.extension.ExtensionContext context, boolean isStatic, Field field) throws IllegalAccessException
- Throws:
IllegalAccessException
-
setFieldIfEqualsToProvidedType
protected void setFieldIfEqualsToProvidedType(org.junit.jupiter.api.extension.ExtensionContext context, boolean isStatic, Field field, Class<?> fieldType, KubernetesMockServerExtension.SetTestClassField setTestClassField) throws IllegalAccessException
- Throws:
IllegalAccessException
-
initializeKubernetesClientAndMockServer
protected void initializeKubernetesClientAndMockServer(Class<?> testClass, boolean isStatic)
-
destroy
protected void destroy()
-
destroyStatic
protected void destroyStatic()
-
getKubernetesMockServerType
protected Class<?> getKubernetesMockServerType()
-
-