use of cucumber.api.DataTable in project cucumber-jvm by cucumber.
the class ToDataTableTest method converts_list_of_beans_to_table.
@Test
public void converts_list_of_beans_to_table() {
List<UserPojo> users = tc.toList(personTable(), UserPojo.class);
DataTable table = tc.toTable(users);
assertEquals("" + " | credits | name | birthDate |\n" + " | 1,000 | Sid Vicious | 10/05/1957 |\n" + " | 3,000 | Frank Zappa | 21/12/1940 |\n" + "", table.toString());
}
use of cucumber.api.DataTable in project cucumber-jvm by cucumber.
the class DataTableTest method canCreateTableFromListOfListOfString.
@Test
public void canCreateTableFromListOfListOfString() {
DataTable dataTable = createSimpleTable();
List<List<String>> listOfListOfString = dataTable.raw();
DataTable other = dataTable.toTable(listOfListOfString);
assertEquals("" + " | one | four | seven |\n" + " | 4444 | 55555 | 666666 |\n", other.toString());
}
use of cucumber.api.DataTable in project cucumber-jvm by cucumber.
the class DataTableTest method createTable.
private DataTable createTable(List<String>... rows) {
List<DataTableRow> simpleRows = new ArrayList<DataTableRow>();
for (int i = 0; i < rows.length; i++) {
simpleRows.add(new DataTableRow(new ArrayList<Comment>(), rows[i], i + 1));
}
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
LocalizedXStreams.LocalizedXStream xStream = new LocalizedXStreams(classLoader).get(Locale.US);
return new DataTable(simpleRows, new TableConverter(xStream, null));
}
use of cucumber.api.DataTable in project syndesis-qe by syndesisio.
the class CommonSteps method validateCredentials.
@And("^.*validate credentials$")
public void validateCredentials() {
Map<String, Account> accounts = AccountsDirectory.getInstance().getAccounts();
List<List<String>> oneAccountList = new ArrayList<>();
List<String> tmpList = Arrays.asList("a", "s", "d", "f");
accounts.keySet().forEach(key -> {
Optional<Account> currentAccount = AccountsDirectory.getInstance().getAccount(key);
if (currentAccount.isPresent()) {
String service = currentAccount.get().getService();
Credentials current = Credentials.valueOf(service.toUpperCase());
switch(current) {
case DROPBOX:
service = "DropBox";
break;
case SALESFORCE:
service = "Salesforce";
break;
case TWITTER:
service = "Twitter";
break;
case S3:
// TODO: skip for now
return;
default:
// skip for other cred
return;
}
// type
tmpList.set(0, service);
// name
tmpList.set(1, key);
// connection name
tmpList.set(2, "my " + key + " connection");
// description
tmpList.set(3, "some description");
log.trace("Inserting: " + tmpList.toString());
oneAccountList.add(new ArrayList<>(tmpList));
log.trace("Current values in list list: " + oneAccountList.toString());
}
});
log.debug("Final status of list: " + oneAccountList.toString());
DataTable accountsTalbe = DataTable.create(oneAccountList);
createConnections(accountsTalbe);
}
Aggregations