Package com.tngtech.jgiven
Class DataTables
- java.lang.Object
-
- com.tngtech.jgiven.DataTables
-
public class DataTables extends java.lang.Object
A utility class to create data tables.
-
-
Constructor Summary
Constructors Constructor Description DataTables()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Iterable<? extends java.lang.Iterable<?>>
table(int numberOfColumns, java.lang.Object... data)
Creates a table, i.e.
-
-
-
Method Detail
-
table
public static java.lang.Iterable<? extends java.lang.Iterable<?>> table(int numberOfColumns, java.lang.Object... data)
Creates a table, i.e. a list of lists, withnumberOfColumns
columns from the givendata
including the header.Example:
table(2, "name", "age", // header "Peter", 20, // first row of data "Susan", 35); // second row of data
- Parameters:
numberOfColumns
- the number of columns the resulting table should havedata
- the data of the table represented as a one-dimensional list, the number of entries must be a multiple ofnumberOfColumns
. The firstnumberOfColumns
elements are taken as the header of the table, the remaining values as data- Returns:
- a list of list that contains the same data as
data
, but in a two-dimensional form - Throws:
java.lang.IllegalArgumentException
- ifdata.length % numberOfColumns != 0
-
-