Class TestWithResourcesExtension

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

    public class TestWithResourcesExtension
    extends java.lang.Object
    implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.ParameterResolver
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void beforeAll​(org.junit.jupiter.api.extension.ExtensionContext context)
      Performs field injection for non-private, static fields (i.e., class fields) that are annotated with one of Given*Resource annotation with content of resource file.
      void beforeEach​(org.junit.jupiter.api.extension.ExtensionContext context)
      Performs field injection for non-private, non-static fields (i.e., instance fields) that are annotated with one of Given*Resource annotation with content of resource file.
      java.lang.Object resolveParameter​(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
      Injects the resource into Parameter in the supplied ParameterContext.
      boolean supportsParameter​(org.junit.jupiter.api.extension.ParameterContext parameterContext, org.junit.jupiter.api.extension.ExtensionContext extensionContext)
      Determines if the Parameter in the supplied ParameterContext is annotated with one of Given*Resource annotation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TestWithResourcesExtension

        public TestWithResourcesExtension()
    • Method Detail

      • beforeAll

        public void beforeAll​(org.junit.jupiter.api.extension.ExtensionContext context)
        Performs field injection for non-private, static fields (i.e., class fields) that are annotated with one of Given*Resource annotation with content of resource file.
        Specified by:
        beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallback
      • beforeEach

        public void beforeEach​(org.junit.jupiter.api.extension.ExtensionContext context)
        Performs field injection for non-private, non-static fields (i.e., instance fields) that are annotated with one of Given*Resource annotation with content of resource file.
        Specified by:
        beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallback
      • 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
        Determines if the Parameter in the supplied ParameterContext is annotated with one of Given*Resource annotation.
        Specified by:
        supportsParameter in interface org.junit.jupiter.api.extension.ParameterResolver
        Throws:
        org.junit.jupiter.api.extension.ParameterResolutionException
      • resolveParameter

        public java.lang.Object resolveParameter​(org.junit.jupiter.api.extension.ParameterContext parameterContext,
                                                 org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                                          throws org.junit.jupiter.api.extension.ParameterResolutionException
        Injects the resource into Parameter in the supplied ParameterContext.
        Specified by:
        resolveParameter in interface org.junit.jupiter.api.extension.ParameterResolver
        Throws:
        org.junit.jupiter.api.extension.ParameterResolutionException