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

com.github.noraui.gherkin.GherkinStepCondition Maven / Gradle / Ivy

There is a newer version: 4.4.0
Show newest version
/**
 * NoraUi is licensed under the license GNU AFFERO GENERAL PUBLIC LICENSE
 * 
 * @author Nicolas HALLOUIN
 * @author Stéphane GRILLON
 */
package com.github.noraui.gherkin;

import com.github.noraui.utils.Context;

public class GherkinStepCondition {

    private String key;
    private String expected;
    private String actual;

    public GherkinStepCondition() {
    }

    public GherkinStepCondition(String key, String expected, String actual) {
        this.key = key;
        this.expected = expected;
        this.actual = actual;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getExpected() {
        return expected;
    }

    public void setExpected(String expected) {
        this.expected = expected;
    }

    public String getActual() {
        return actual;
    }

    public void setActual(String actual) {
        this.actual = actual;
    }

    public boolean checkCondition() {
        String actu = Context.getValue(this.actual) != null ? Context.getValue(this.actual) : this.actual;
        if (actu == null) {
            return false;
        }
        return actu.matches("(?i)" + this.expected);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy