Class ConfigurableEmbedder

All Implemented Interfaces:
Direct Known Subclasses:

public abstract class ConfigurableEmbedder extends InjectableEmbedder

Abstract implementation of Embeddable which extends InjectableEmbedder to allow the configuration using the Configuration and the InjectableStepsFactory specified.

The instances of the Configuration and the InjectableStepsFactory can be provided either via the useConfiguration(Configuration) and useStepsFactory(InjectableStepsFactory) methods or overriding the configuration() and stepsFactory() methods.

If overriding the configuration() method and providing an InjectableStepsFactory which requires a Configuration, then care must be taken to avoid re-instantiating the Configuration. E.g.:

 public Configuration configuration() {
   if (super.hasConfiguration()) {
     return super.configuration();
   return new MostUsefulConfiguration()...;

Note that no defaults are provided by this implementation. If no values are set by the subclasses, then null values are passed to the configured Embedder, which is responsible for setting the default values.

Typically, users that use JUnit will find it easier to extend other implementations, such as JUnitStories which implement the using the configured Embedder and annotate it with JUnit's annotations.

  • Constructor Details

    • ConfigurableEmbedder

      public ConfigurableEmbedder()
  • Method Details

    • useConfiguration

      public void useConfiguration(Configuration configuration)
    • configuration

      public Configuration configuration()
    • hasConfiguration

      public boolean hasConfiguration()
    • useStepsFactory

      public void useStepsFactory(InjectableStepsFactory stepsFactory)
    • stepsFactory

      public InjectableStepsFactory stepsFactory()
    • hasStepsFactory

      public boolean hasStepsFactory()
    • configuredEmbedder

      public Embedder configuredEmbedder()