Package io.getunleash

Class FakeUnleash

java.lang.Object
io.getunleash.FakeUnleash
All Implemented Interfaces:
Unleash

public class FakeUnleash extends Object implements Unleash
  • Constructor Details

    • FakeUnleash

      public FakeUnleash()
    • FakeUnleash

      public FakeUnleash(MetricsAPI metricsAPI)
  • Method Details

    • isEnabled

      public boolean isEnabled(String toggleName, UnleashContext context, BiPredicate<String,UnleashContext> fallbackAction)
      Specified by:
      isEnabled in interface Unleash
    • getVariant

      public Variant getVariant(String toggleName, UnleashContext context)
      Specified by:
      getVariant in interface Unleash
    • getVariant

      public Variant getVariant(String toggleName, UnleashContext context, Variant defaultValue)
      Specified by:
      getVariant in interface Unleash
    • getVariant

      public Variant getVariant(String toggleName)
      Specified by:
      getVariant in interface Unleash
    • getVariant

      public Variant getVariant(String toggleName, Variant defaultValue)
      Specified by:
      getVariant in interface Unleash
    • more

      public MoreOperations more()
      Specified by:
      more in interface Unleash
    • getImpactMetrics

      public MetricsAPI getImpactMetrics()
      Specified by:
      getImpactMetrics in interface Unleash
    • enableAll

      public void enableAll()
    • enableAllExcept

      public void enableAllExcept(String... excludedFeatures)
    • disableAll

      public void disableAll()
    • disableAllExcept

      public void disableAllExcept(String... excludedFeatures)
    • resetAll

      public void resetAll()
    • enable

      public void enable(String... features)
    • disable

      public void disable(String... features)
    • reset

      public void reset(String... features)
    • conditionallyEnable

      public void conditionallyEnable(Predicate<UnleashContext> contextMatcher, String... features)
      Enables or disables feature toggles depending on the evaluation of the contextMatcher. This can be called multiple times. If any of the context matchers match, the feature is enabled. This lets you conditionally configure multiple different tests to do different things, while running concurrently.

      This will be overwritten if enable(String...) or disable(String...) are called and vice versa.

      Parameters:
      contextMatcher - the context matcher to evaluate
      features - the features for which the context matcher will be invoked
    • setVariant

      public void setVariant(String toggleName, Variant variant)