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

cucumber.runtime.table.DataTableDiff Maven / Gradle / Ivy

There is a newer version: 7.18.1
Show newest version
package cucumber.runtime.table;

import cucumber.api.DataTable;
import cucumber.api.TableConverter;
import gherkin.pickles.PickleRow;
import gherkin.pickles.PickleTable;

import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.List;

public class DataTableDiff extends DataTable {
    public enum DiffType {
        NONE, DELETE, INSERT
    }

    private List diffTypes;

    public static DataTableDiff create(List> diffTableRows, TableConverter tableConverter) {
        List rows = new ArrayList(diffTableRows.size());
        List diffTypes = new ArrayList(diffTableRows.size());
        for (SimpleEntry row : diffTableRows) {
            rows.add(row.getKey());
            diffTypes.add(row.getValue());
        }
        return new DataTableDiff(new PickleTable(rows), diffTypes, tableConverter);
    }

    public DataTableDiff(PickleTable pickleTable, List diffTypes, TableConverter tableConverter) {
        super(pickleTable, tableConverter);
        this.diffTypes = diffTypes;

    }

    @Override
    protected TablePrinter createTablePrinter() {
        return new DiffTablePrinter(diffTypes);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy