Class 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
    • Constructor Detail

      • KubernetesMockServerExtension

        public KubernetesMockServerExtension()
    • Method Detail

      • afterEach

        public void afterEach​(org.junit.jupiter.api.extension.ExtensionContext context)
        Specified by:
        afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback
      • afterAll

        public void afterAll​(org.junit.jupiter.api.extension.ExtensionContext context)
        Specified by:
        afterAll in interface org.junit.jupiter.api.extension.AfterAllCallback
      • beforeEach

        public void beforeEach​(org.junit.jupiter.api.extension.ExtensionContext context)
                        throws Exception
        Specified by:
        beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallback
        Throws:
        Exception
      • beforeAll

        public void beforeAll​(org.junit.jupiter.api.extension.ExtensionContext context)
                       throws Exception
        Specified by:
        beforeAll in interface org.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
      • initializeKubernetesClientAndMockServer

        protected void initializeKubernetesClientAndMockServer​(Class<?> testClass,
                                                               boolean isStatic)
      • destroy

        protected void destroy()
      • destroyStatic

        protected void destroyStatic()
      • getKubernetesMockServerType

        protected Class<?> getKubernetesMockServerType()