Class ConfigurableEmbedder
- java.lang.Object
-
- org.jbehave.core.InjectableEmbedder
-
- org.jbehave.core.ConfigurableEmbedder
-
- All Implemented Interfaces:
Embeddable
- Direct Known Subclasses:
JupiterStories
public abstract class ConfigurableEmbedder extends InjectableEmbedder
Abstract implementation of
Embeddable
which extendsInjectableEmbedder
to allow the configuration using theConfiguration
and theInjectableStepsFactory
specified.The instances of the
Configuration
and theInjectableStepsFactory
can be provided either via theuseConfiguration(Configuration)
anduseStepsFactory(InjectableStepsFactory)
methods or overriding theconfiguration()
andstepsFactory()
methods.If overriding the
configuration()
method and providing anInjectableStepsFactory
which requires aConfiguration
, then care must be taken to avoid re-instantiating theConfiguration
. 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 configuredEmbedder
, 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 theEmbeddable.run()
using the configuredEmbedder
and annotate it with JUnit's annotations.
-
-
Constructor Summary
Constructors Constructor Description ConfigurableEmbedder()
-
Method Summary
Modifier and Type Method Description Configuration
configuration()
Embedder
configuredEmbedder()
boolean
hasConfiguration()
boolean
hasStepsFactory()
InjectableStepsFactory
stepsFactory()
void
useConfiguration(Configuration configuration)
void
useStepsFactory(InjectableStepsFactory stepsFactory)
-
Methods inherited from class org.jbehave.core.InjectableEmbedder
injectedEmbedder, useEmbedder
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jbehave.core.Embeddable
run
-
-
-
-
Method Detail
-
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()
-
-