Enum Class Mode

java.lang.Object
java.lang.Enum<Mode>
org.apache.juneau.bct.junit.Mode
All Implemented Interfaces:
Serializable, Comparable<Mode>, Constable

public enum Mode extends Enum<Mode>
Wiring mode for a @TestBean-declared override.

Selects how the JuneauBeanStoreExtension threads the overlay into the system under test. See JuneauBeanStoreExtension for the full INJECT vs OVERLAY contracts.

See Also:
Since:
10.0.0
  • Enum Constant Details

    • INJECT

      public static final Mode INJECT
      Construction-time wiring — the default.

      The bean is wired into the SUT at construction time via the builder's overridingBeanStore(...) setter; the SUT doesn't exist until the overlay is applied. The overlay is installed in the overridingParent slot of the SUT's bean store at construction time and is universal — every bean type is eligible for replacement, including framework-managed ones that subsequently pin into per-op memoizers. Best for fresh-instance test isolation.

      INJECT overrides do not require the extension to be attached to an existing bean store.

    • OVERLAY

      public static final Mode OVERLAY
      Push/pop wiring on a live SUT.

      The bean is overlaid onto an already-constructed SUT for the duration of a test scope, then removed via WritableBeanStore.popOverlay(org.apache.juneau.commons.inject.Snapshot). Requires JuneauBeanStoreExtension.attach(org.apache.juneau.commons.inject.WritableBeanStore) to point the extension at the SUT's bean store; per-test overlays are pushed via WritableBeanStore.pushOverlay(org.apache.juneau.commons.inject.BeanStore) at beforeEach / beforeAll and popped at afterEach / afterAll. Best when SUT construction is expensive and tests share a live instance.

      OVERLAY overrides only influence beans the framework resolves through the bean store per-call. Beans pinned into per-op memoizers at boot are not re-resolved — for those, use INJECT (fresh SUT).

  • Method Details

    • values

      public static Mode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Mode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null