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.
Method Summary |
void |
addIntroWord(String word)
|
Scenario<GIVEN,WHEN,THEN> |
as(String description)
Alias for startScenario(String) |
static
<GIVEN,WHEN,THEN>
Scenario<GIVEN,WHEN,THEN> |
|
create(Class<GIVEN> givenClass,
Class<WHEN> whenClass,
Class<THEN> thenClass)
Creates a scenario with 3 different steps classes. |
static
|
create(Class<STEPS> stepsClass)
Creates a scenario with a single steps class. |
GIVEN |
getGivenStage()
|
THEN |
getThenStage()
|
WHEN |
getWhenStage()
|
GIVEN |
given()
|
GIVEN |
given(String translatedGiven)
|
Scenario<GIVEN,WHEN,THEN> |
startScenario(String description)
Describes the scenario. |
THEN |
then()
|
THEN |
then(String translatedGiven)
|
WHEN |
when()
|
WHEN |
when(String translatedGiven)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Scenario
public Scenario(Class<GIVEN> givenClass,
Class<WHEN> whenClass,
Class<THEN> thenClass)
getGivenStage
public GIVEN getGivenStage()
getWhenStage
public WHEN getWhenStage()
getThenStage
public THEN getThenStage()
addIntroWord
public void addIntroWord(String word)
create
public static <GIVEN,WHEN,THEN> Scenario<GIVEN,WHEN,THEN> create(Class<GIVEN> givenClass,
Class<WHEN> whenClass,
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(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(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(String description)
- Alias for
startScenario(String)
given
public GIVEN given()
when
public WHEN when()
then
public THEN then()
given
public GIVEN given(String translatedGiven)
when
public WHEN when(String translatedGiven)
then
public THEN then(String translatedGiven)
Copyright © 2014 TNG Technology Consulting. All rights reserved.