All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cucumber.api.Transpose Maven / Gradle / Ivy

There is a newer version: 7.18.0
Show newest version
package cucumber.api;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 

* This annotation can be specified on step definition method parameters to give Cucumber a hint * to transpose a DataTable. *

* For example, if you have the following Gherkin step with a table *

 * Given the user is
 *    | firstname	| Roberto	|
 *    | lastname	| Lo Giacco |
 *    | nationality	| Italian	|
 * 
*

* And a data table type to create a User * *

 * typeRegistry.defineDataTableType(new DataTableType(
 *    Author.class,
 *    new TableEntryTransformer<User>() {
 *    @Override
 *    public Author transform(Map<String, String> entry) {
 *       return new User(
 *          entry.get("firstName"),
 *          entry.get("lastName"),
 *          entry.get("nationality"));
 *    }
 * }));
 *
 * 
* Then the following Java Step Definition would convert that into an User object: *
 * @Given("^the user is$")
 * public void the_user_is(@Transpose User user) {
 *     this.user = user;
 * }
 * 
*/ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.PARAMETER}) public @interface Transpose { boolean value() default true; }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy