Class StageBase<SELF extends StageBase<?>>

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

public class StageBase<SELF extends StageBase<?>> extends 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:
  • Constructor Details

    • StageBase

      public StageBase()
  • Method Details

    • self

      @Hidden public SELF self()
    • $

      public SELF $(String description, @Hidden StepFunction<? super SELF> function) throws 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:
      Exception
      Since:
      0.7.1
    • $

      public SELF $(String description)
      A simple helper to provide a description

      Example 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