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

com.smartbear.readyapi.client.assertions.DefaultGroovyScriptAssertionBuilder Maven / Gradle / Ivy

Go to download

Java client library for creating and executing test recipes against Ready!API TestServer

The newest version!
package com.smartbear.readyapi.client.assertions;

import com.smartbear.readyapi.client.model.GroovyScriptAssertion;

import static com.smartbear.readyapi.client.Validator.validateNotEmpty;

public class DefaultGroovyScriptAssertionBuilder extends AbstractAssertionBuilder
implements GroovyScriptAssertionBuilder {
    private GroovyScriptAssertion scriptAssertion = new GroovyScriptAssertion();

    public DefaultGroovyScriptAssertionBuilder(String script) {
        scriptAssertion.setScript(script);
    }

    @Override
    public DefaultGroovyScriptAssertionBuilder named(String name) {
        scriptAssertion.setName(name);
        return this;
    }

    @Override
    public GroovyScriptAssertion build() {
        validateNotEmpty(scriptAssertion.getScript(), "Missing script. Script is a mandatory parameter for ScriptAssertion");
        scriptAssertion.setType(Assertions.SCRIPT_ASSERTION_TYPE);
        return scriptAssertion;
    }

    public final static GroovyScriptAssertion create(){
        GroovyScriptAssertion assertion = new GroovyScriptAssertion();
        assertion.setType(Assertions.SCRIPT_ASSERTION_TYPE);
        return assertion;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy