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

net.thucydides.core.model.DataTableRow Maven / Gradle / Ivy

There is a newer version: 4.2.1
Show newest version
package net.thucydides.core.model;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class DataTableRow {
    private List values;  // A list of strings or integers
    private TestResult result;

    public DataTableRow(List values) {
        this(values, TestResult.UNDEFINED);
    }

    public DataTableRow(List values, TestResult result) {
        this.values = new ArrayList<>(values);
        this.result = result;
    }

    public List getValues() {
        return new ArrayList<>(values);
    }

    public List getStringValues() {

        return values.stream().map(
                value -> (value == null) ? "" : value.toString()
        ).collect(Collectors.toList());
    }

    public TestResult getResult() {
        return result;
    }

    public void setResult(TestResult result) {
        this.result = result;
    }

    public void updateResult(TestResult newResult) {
        if (newResult == TestResult.UNDEFINED) {
            setResult(newResult);
        } else {
            setResult(TestResultComparison.overallResultFor(this.result, newResult));
        }
    }

    @Override
    public String toString() {
        return "DataTableRow{" +
                "values=" + values +
                ", result=" + result +
                '}';
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy