com.tngtech.jgiven.base
Class StageBase<SELF extends StageBase<?>>

java.lang.Object
  extended by com.tngtech.jgiven.base.StageBase<SELF>
Type Parameters:
SELF - the type of the subclass
Direct Known Subclasses:
Stage, Stufe

public class StageBase<SELF extends StageBase<?>>
extends java.lang.Object

Useful base class for step definitions as it provides a self() method to create fluent interfaces.

Direct subclasses should provide introduction words (see IntroWord).

Typically one derives from one of the language-specific step definition classes, which already provide a handful of useful introduction words.

See Also:
Stage, Stufe

Constructor Summary
StageBase()
           
 
Method Summary
 SELF $(java.lang.String description, StepFunction<? super SELF> function)
          A step method for creating ad-hoc steps using lambdas.
 SELF self()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StageBase

public StageBase()
Method Detail

self

public SELF self()

$

public SELF $(java.lang.String description,
              @Hidden
              StepFunction<? super SELF> function)
                            throws java.lang.Exception
A step method for creating ad-hoc steps using lambdas.

Example Usage

given().$( "Two negative arguments", stage -> {
        stage.given().argument( -5 )
             .and().argument( -6 );
     });
 

Parameters:
description - the description of the step
function - the implementation of the step in form of a function where the parameter is the stage the step is executed in
Throws:
java.lang.Exception
Since:
0.7.1