Class ConfigOverrideExtensionValue

java.lang.Object
io.dropwizard.testing.ConfigOverride
ru.vyarus.dropwizard.guice.test.util.ConfigOverrideExtensionValue
All Implemented Interfaces:
ConfigurablePrefix

public class ConfigOverrideExtensionValue extends io.dropwizard.testing.ConfigOverride implements ConfigurablePrefix
Config override implementation for values computed in 3rd party junit 5 extensions. Such extension must put value into junit storage (preferably, with key equal to overriding property path). This value would be resolved under junit "before all" phase, just before dropwizard test support object creation (and so 3rd party extension MUST be executed before guicey extension).
Since:
10.05.2022
  • Constructor Details

    • ConfigOverrideExtensionValue

      public ConfigOverrideExtensionValue(org.junit.jupiter.api.extension.ExtensionContext.Namespace namespace, String storageKey, String configPath)
      Create a config override value.
      Parameters:
      namespace - namespace
      storageKey - storage key
      configPath - config yaml path
  • Method Details

    • setPrefix

      public void setPrefix(String prefix)
      Specified by:
      setPrefix in interface ConfigurablePrefix
      Parameters:
      prefix - current test's prefix
    • resolveValue

      public void resolveValue(org.junit.jupiter.api.extension.ExtensionContext context)
      Called to resolve actual value from configured namespace. 3rd party extension must already initialize value in the store.
      Parameters:
      context - test context
    • addToSystemProperties

      public void addToSystemProperties()
      Specified by:
      addToSystemProperties in class io.dropwizard.testing.ConfigOverride
    • removeFromSystemProperties

      public void removeFromSystemProperties()
      Specified by:
      removeFromSystemProperties in class io.dropwizard.testing.ConfigOverride