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

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

Go to download

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

There is a newer version: 1.2.1
Show newest version
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