com.tngtech.jgiven.impl
Class Scenario<GIVEN,WHEN,THEN>

java.lang.Object
  extended by com.tngtech.jgiven.impl.ScenarioBase
      extended by com.tngtech.jgiven.impl.Scenario<GIVEN,WHEN,THEN>
Type Parameters:
GIVEN - the Given stage
WHEN - then When stage
THEN - then Then stage

public class Scenario<GIVEN,WHEN,THEN>
extends ScenarioBase

A default scenario implementation that takes three type arguments, one for each stage.


Field Summary
 
Fields inherited from class com.tngtech.jgiven.impl.ScenarioBase
executor, modelBuilder
 
Constructor Summary
Scenario(Class<GIVEN> givenClass, Class<WHEN> whenClass, Class<THEN> thenClass)
           
 
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
<STEPS> Scenario<STEPS,STEPS,STEPS>
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 com.tngtech.jgiven.impl.ScenarioBase
addStage, finished, getExecutor, getModel, getModelBuilder, setModel, wireSteps
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scenario

public Scenario(Class<GIVEN> givenClass,
                Class<WHEN> whenClass,
                Class<THEN> thenClass)
Method Detail

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 class
whenClass - the When steps class
thenClass - 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.