public abstract class ConfigurableEmbedder extends Object implements Embeddable
Abstract implementation of Embeddable
which allows to configure the
Embedder
used to run the stories, 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 {@link Embedder}, which is responsible for setting the default
values.
Typically, users that use JUnit will find it easier to extend other implementations, such as {@link JUnitStory} or {@link JUnitStories}, which implement the {@link#run()} using the configured {@link Embedder} and annotate it with JUnit's annotations.
Constructor and Description |
---|
ConfigurableEmbedder() |
Modifier and Type | Method and Description |
---|---|
void |
addSteps(CandidateSteps... steps)
Deprecated.
|
void |
addSteps(List<CandidateSteps> steps)
Deprecated.
|
List<CandidateSteps> |
candidateSteps()
Deprecated.
Use
stepsFactory() |
Configuration |
configuration() |
Embedder |
configuredEmbedder() |
boolean |
hasConfiguration() |
boolean |
hasStepsFactory() |
InjectableStepsFactory |
stepsFactory() |
void |
useConfiguration(Configuration configuration) |
void |
useEmbedder(Embedder embedder) |
void |
useStepsFactory(InjectableStepsFactory stepsFactory) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
run
public void useEmbedder(Embedder embedder)
useEmbedder
in interface Embeddable
public void useConfiguration(Configuration configuration)
public Configuration configuration()
public boolean hasConfiguration()
@Deprecated public void addSteps(CandidateSteps... steps)
useStepsFactory(InjectableStepsFactory)
@Deprecated public void addSteps(List<CandidateSteps> steps)
useStepsFactory(InjectableStepsFactory)
@Deprecated public List<CandidateSteps> candidateSteps()
stepsFactory()
public void useStepsFactory(InjectableStepsFactory stepsFactory)
public InjectableStepsFactory stepsFactory()
public boolean hasStepsFactory()
public Embedder configuredEmbedder()
Copyright © 2003–2021. All rights reserved.