Interface ConfigurableScenarioDecider.SpecificScenarioDecider

  • All Known Implementing Classes:
    ConfigurableScenarioDecider.StandardSpecificScenarioDecider
    Enclosing class:
    ConfigurableScenarioDecider
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public static interface ConfigurableScenarioDecider.SpecificScenarioDecider
    An implementation of this interface can decide whether a specific Mats Scenario is active. The Spring Environment is provided from which Spring Profiles and properties/variables can be gotten. Notice that in the default Spring configuration, the Environment is populated by System Properties (Java command line "-Dproperty=vale"-properties) and System Environment. However, an implementation of this interface might use whatever it find relevant to do a decision.
    See Also:
    ConfigurableScenarioDecider.StandardSpecificScenarioDecider
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.Optional<java.lang.String> scenarioActive​(org.springframework.core.env.Environment env)
      Decides whether a specific Scenario is active.
    • Method Detail

      • scenarioActive

        java.util.Optional<java.lang.String> scenarioActive​(org.springframework.core.env.Environment env)
        Decides whether a specific Scenario is active.
        Parameters:
        env - the Spring Environment, from which Spring Profiles and properties/variables can be gotten. Notice that in the default Spring configuration, the Environment is populated by System Properties (Java command line "-Dproperty=value"-properties) and System Environment.
        Returns:
        an Optional, which if present means that the specific Mats Scenario is active - and the returned String is used in logging to show why this Scenario was chosen (a string like e.g. "Found active Spring Profile 'mats-test'" would make sense). If Optional.empty(), this specific Mats Scenario was not active.