Class VertxExtension

  • All Implemented Interfaces:
    org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.InvocationInterceptor, org.junit.jupiter.api.extension.ParameterResolver

    public final class VertxExtension
    extends Object
    implements org.junit.jupiter.api.extension.ParameterResolver, org.junit.jupiter.api.extension.InvocationInterceptor
    JUnit 5 Vert.x extension that allows parameter injection as well as an automatic lifecycle on the VertxTestContext instance.

    The following types can be injected:

    • Vertx
    • VertxTestContext
    • io.vertx.rxjava.core.Vertx
    • io.vertx.reactivex.core.Vertx
    • io.vertx.rxjava3.core.Vertx
    Author:
    Julien Ponge
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor

        org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<T extends Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      VertxExtension()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void interceptAfterAllMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)  
      void interceptAfterEachMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)  
      void interceptBeforeAllMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)  
      void interceptBeforeEachMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)  
      void interceptDynamicTest​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.DynamicTestInvocationContext invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)  
      void interceptTestMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)  
      void interceptTestTemplateMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation, org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)  
      Object resolveParameter​(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)  
      boolean supportsParameter​(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)  
      • Methods inherited from interface org.junit.jupiter.api.extension.InvocationInterceptor

        interceptDynamicTest, interceptTestClassConstructor, interceptTestFactoryMethod
    • Field Detail

      • DEFAULT_TIMEOUT_DURATION

        public static final int DEFAULT_TIMEOUT_DURATION
        Default timeout.
        See Also:
        Constant Field Values
      • DEFAULT_TIMEOUT_UNIT

        public static final TimeUnit DEFAULT_TIMEOUT_UNIT
        Default timeout unit.
      • VERTX_INSTANCE_KEY

        public static final String VERTX_INSTANCE_KEY
        Key for all Vertx instances, including what shims like RxJava should use.
        See Also:
        Constant Field Values
    • Constructor Detail

      • VertxExtension

        public VertxExtension()
    • Method Detail

      • supportsParameter

        public boolean supportsParameter​(org.junit.jupiter.api.extension.ParameterContext parameterContext,
                                         org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                  throws org.junit.jupiter.api.extension.ParameterResolutionException
        Specified by:
        supportsParameter in interface org.junit.jupiter.api.extension.ParameterResolver
        Throws:
        org.junit.jupiter.api.extension.ParameterResolutionException
      • resolveParameter

        public Object resolveParameter​(org.junit.jupiter.api.extension.ParameterContext parameterContext,
                                       org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                throws org.junit.jupiter.api.extension.ParameterResolutionException
        Specified by:
        resolveParameter in interface org.junit.jupiter.api.extension.ParameterResolver
        Throws:
        org.junit.jupiter.api.extension.ParameterResolutionException
      • interceptBeforeAllMethod

        public void interceptBeforeAllMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                             org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext,
                                             org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                      throws Throwable
        Specified by:
        interceptBeforeAllMethod in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • interceptAfterAllMethod

        public void interceptAfterAllMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                            org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext,
                                            org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                     throws Throwable
        Specified by:
        interceptAfterAllMethod in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • interceptTestMethod

        public void interceptTestMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                        org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext,
                                        org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                 throws Throwable
        Specified by:
        interceptTestMethod in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • interceptBeforeEachMethod

        public void interceptBeforeEachMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                              org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext,
                                              org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                       throws Throwable
        Specified by:
        interceptBeforeEachMethod in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • interceptTestTemplateMethod

        public void interceptTestTemplateMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                                org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext,
                                                org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                         throws Throwable
        Specified by:
        interceptTestTemplateMethod in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • interceptDynamicTest

        public void interceptDynamicTest​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                         org.junit.jupiter.api.extension.DynamicTestInvocationContext invocationContext,
                                         org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                  throws Throwable
        Specified by:
        interceptDynamicTest in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable
      • interceptAfterEachMethod

        public void interceptAfterEachMethod​(org.junit.jupiter.api.extension.InvocationInterceptor.Invocation<Void> invocation,
                                             org.junit.jupiter.api.extension.ReflectiveInvocationContext<Method> invocationContext,
                                             org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                      throws Throwable
        Specified by:
        interceptAfterEachMethod in interface org.junit.jupiter.api.extension.InvocationInterceptor
        Throws:
        Throwable