Class ConfigurableScenarioDecider.StandardSpecificScenarioDecider

All Implemented Interfaces:
Enclosing class:

public static class ConfigurableScenarioDecider.StandardSpecificScenarioDecider extends Object implements ConfigurableScenarioDecider.SpecificScenarioDecider
Standard implementation of ConfigurableScenarioDecider.SpecificScenarioDecider used in the default configuration of ConfigurableScenarioDecider, which takes a set of profile-or-properties names and checks whether they are present as a Spring Profile, or (with the "-" replaced by ".") whether it exists as a property in the Spring Environment.
  • Constructor Details

    • StandardSpecificScenarioDecider

      public StandardSpecificScenarioDecider(String... profileOrPropertyNames)
  • Method Details

    • scenarioActive

      public Optional<String> scenarioActive(org.springframework.core.env.Environment env)
      Description copied from interface: ConfigurableScenarioDecider.SpecificScenarioDecider
      Decides whether a specific Scenario is active.
      Specified by:
      scenarioActive in interface ConfigurableScenarioDecider.SpecificScenarioDecider
      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.
      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.
    • isProfileOrPropertyPresent

      public static Optional<String> isProfileOrPropertyPresent(org.springframework.core.env.Environment env, String... profileNames)