com.smartbear.readyapi.client.assertions.DefaultContainsAssertionBuilder 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
package com.smartbear.readyapi.client.assertions;
import com.smartbear.readyapi.client.model.SimpleContainsAssertion;
import static com.smartbear.readyapi.client.Validator.validateNotEmpty;
public class DefaultContainsAssertionBuilder extends AbstractAssertionBuilder implements ContainsAssertionBuilder {
protected SimpleContainsAssertion containsAssertion = new SimpleContainsAssertion();
public DefaultContainsAssertionBuilder(String token) {
containsAssertion.setToken(token);
}
@Override
public ContainsAssertionBuilder useRegEx() {
containsAssertion.setUseRegexp(true);
return this;
}
@Override
public ContainsAssertionBuilder ignoreCase() {
containsAssertion.setIgnoreCase(true);
return this;
}
@Override
public SimpleContainsAssertion build() {
validateNotEmpty(containsAssertion.getToken(), "Missing token, it's a mandatory parameter for ContainsAssertion");
containsAssertion.setType(Assertions.CONTAINS_ASSERTION_TYPE);
return containsAssertion;
}
public static SimpleContainsAssertion create(){
SimpleContainsAssertion assertion = new SimpleContainsAssertion();
assertion.setType(Assertions.CONTAINS_ASSERTION_TYPE);
return assertion;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy