com.smartbear.readyapi.client.assertions.DefaultGroovyScriptAssertionBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ready-api-testserver-client Show documentation
Show all versions of ready-api-testserver-client Show documentation
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;
}
}