com.tngtech.jgiven.impl
Class Scenario<GIVEN,WHEN,THEN>
java.lang.Object
com.tngtech.jgiven.impl.ScenarioBase
com.tngtech.jgiven.impl.Scenario<GIVEN,WHEN,THEN>
- Type Parameters:
GIVEN
- the Given stageWHEN
- then When stageTHEN
- then Then stage
public class Scenario<GIVEN,WHEN,THEN>
- extends ScenarioBase
A default scenario implementation that takes three type arguments,
one for each stage.
Constructor Summary |
Scenario(java.lang.Class<GIVEN> givenClass,
java.lang.Class<WHEN> whenClass,
java.lang.Class<THEN> thenClass)
|
Method Summary |
void |
addIntroWord(java.lang.String word)
|
Scenario<GIVEN,WHEN,THEN> |
as(java.lang.String description)
Alias for startScenario(String) . |
static
<GIVEN,WHEN,THEN>
Scenario<GIVEN,WHEN,THEN> |
|
create(java.lang.Class<GIVEN> givenClass,
java.lang.Class<WHEN> whenClass,
java.lang.Class<THEN> thenClass)
Creates a scenario with 3 different steps classes. |
static
|
create(java.lang.Class<STEPS> stepsClass)
Creates a scenario with a single steps class. |
GIVEN |
getGivenStage()
|
THEN |
getThenStage()
|
WHEN |
getWhenStage()
|
GIVEN |
given()
|
GIVEN |
given(java.lang.String translatedGiven)
|
Scenario<GIVEN,WHEN,THEN> |
startScenario(java.lang.String description)
Describes the scenario. |
THEN |
then()
|
THEN |
then(java.lang.String translatedGiven)
|
WHEN |
when()
|
WHEN |
when(java.lang.String translatedGiven)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Scenario
public Scenario(java.lang.Class<GIVEN> givenClass,
java.lang.Class<WHEN> whenClass,
java.lang.Class<THEN> thenClass)
getGivenStage
public GIVEN getGivenStage()
getWhenStage
public WHEN getWhenStage()
getThenStage
public THEN getThenStage()
addIntroWord
public void addIntroWord(java.lang.String word)
create
public static <GIVEN,WHEN,THEN> Scenario<GIVEN,WHEN,THEN> create(java.lang.Class<GIVEN> givenClass,
java.lang.Class<WHEN> whenClass,
java.lang.Class<THEN> thenClass)
- Creates a scenario with 3 different steps classes.
To share state between the different steps instances use the
ScenarioState
annotation
- Parameters:
givenClass
- the Given steps classwhenClass
- the When steps classthenClass
- the Then steps class
- Returns:
- the new scenario
create
public static <STEPS> Scenario<STEPS,STEPS,STEPS> create(java.lang.Class<STEPS> stepsClass)
- Creates a scenario with a single steps class.
Only creates a single steps instance for all three step types,
so no
ScenarioState
annotations are needed
to share state between the different steps instances.
- Parameters:
stepsClass
- the class to use for given, when and then steps
- Returns:
- the new scenario
startScenario
public Scenario<GIVEN,WHEN,THEN> startScenario(java.lang.String description)
- Describes the scenario. Must be called before any step invocation.
- Overrides:
startScenario
in class ScenarioBase
- Parameters:
description
- the description
- Returns:
- this for a fluent interface
as
public Scenario<GIVEN,WHEN,THEN> as(java.lang.String description)
- Alias for
startScenario(String)
.
given
public GIVEN given()
when
public WHEN when()
then
public THEN then()
given
public GIVEN given(java.lang.String translatedGiven)
when
public WHEN when(java.lang.String translatedGiven)
then
public THEN then(java.lang.String translatedGiven)