Package com.tngtech.jgiven.base
Class StageBase<SELF extends StageBase<?>>
- java.lang.Object
-
- com.tngtech.jgiven.base.StageBase<SELF>
-
- Type Parameters:
SELF
- the type of the subclass
public class StageBase<SELF extends StageBase<?>> extends java.lang.Object
Useful base class for step definitions as it provides aself()
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.
-
-
Constructor Summary
Constructors Constructor Description StageBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SELF
$(java.lang.String description)
A simple helper to provide a descriptionSELF
$(java.lang.String description, StepFunction<? super SELF> function)
A step method for creating ad-hoc steps using lambdas.SELF
self()
-
-
-
Method Detail
-
$
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 stepfunction
- 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
-
$
public SELF $(java.lang.String description)
A simple helper to provide a descriptionExample Usage
given().$( "a description to improve the report, but is not related to any code that needs to be executed");
); }- Parameters:
description
- the description of the step- Since:
- 0.15.4
-
-