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

com.qmetry.qaf.automation.cucumber.bdd2.model.BDD2DataTableArgument Maven / Gradle / Ivy

Go to download

Functional test automation framework for web, mobile-web, mobile native and web-service

There is a newer version: 4.0.0-RC3
Show newest version
/**
 * 
 */
package com.qmetry.qaf.automation.cucumber.bdd2.model;

import java.util.AbstractList;
import java.util.List;

import gherkin.pickles.PickleTable;
import io.cucumber.core.gherkin.DataTableArgument;

/**
 * @author chirag.jayswal
 *
 */
public class BDD2DataTableArgument implements DataTableArgument {
	private final CellView cells;
	private final int line;

	BDD2DataTableArgument(PickleTable table) {
		this.cells = new CellView(table);
		this.line = table.getLocation().getLine();
	}

	@Override
	public List> cells() {
		return cells;
	}

	@Override
	public int getLine() {
		return line;
	}

	private static class CellView extends AbstractList> {
		private final PickleTable table;

		CellView(PickleTable table) {
			this.table = table;
		}

		@Override
		public List get(int row) {
			return new AbstractList() {
				@Override
				public String get(int column) {
					return table.getRows().get(row).getCells().get(column).getValue();
				}

				@Override
				public int size() {
					return table.getRows().get(row).getCells().size();
				}
			};
		}

		@Override
		public int size() {
			return table.getRows().size();
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy