You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package project.datatables;
import java.util.Locale;
import java.util.Map;
import cucumber.api.TypeRegistry;
import cucumber.api.TypeRegistryConfigurer;
import io.cucumber.datatable.DataTable;
import io.cucumber.datatable.DataTableType;
import io.cucumber.datatable.TableEntryTransformer;
import io.cucumber.datatable.TableTransformer;
import project.dataobjects.Transaction;
public class Configurer implements TypeRegistryConfigurer {
@Override
public Locale locale() {
return Locale.ENGLISH;
}
@Override
public void configureTypeRegistry(TypeRegistry registry) {
/*
* Maps DataTable with header row to multiple objects of Type<T>. Each row below
* the header is an object.
*/
registry.defineDataTableType(new DataTableType(Transaction.class, new TableEntryTransformer<Transaction>() {
@Override
public Transaction transform(Map<String, String> entry) {
return Transaction.getInstance(entry);
}
}));
/*
* Maps DataTable with label column to a single object of Type<T>. Left column
* is field name, right column is value.
*/
registry.defineDataTableType(new DataTableType(Transaction.class, new TableTransformer<Transaction>() {
@Override
public Transaction transform(DataTable table) throws Throwable {
return Transaction.getInstance(table.asMaps().get(0));
}
}));
}
}
Changes:
https://cucumber.io/blog/2018/09/24/announcing-cucumber-jvm-4-0-0
https://cucumber.io/blog/2018/10/31/announcing-cucumber-jvm-4-2-0
DataTables:
http://grasshopper.tech/340/
https://github.com/grasshopper7/cuke4-parameter-datatable
The text was updated successfully, but these errors were encountered: