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

com.smartbear.readyapi.client.assertions.XQueryContainsAssertionBuilder 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.XQueryContainsAssertion;

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

public class XQueryContainsAssertionBuilder extends AbstractAssertionBuilder implements XQueryAssertionBuilder {
    private XQueryContainsAssertion xQueryContainsAssertion = new XQueryContainsAssertion();

    XQueryContainsAssertionBuilder(String xQuery, String expectedContent) {
        xQueryContainsAssertion.setXquery(xQuery);
        xQueryContainsAssertion.setExpectedContent(expectedContent);
    }

    @Override
    public XQueryContainsAssertionBuilder named(String name) {
        xQueryContainsAssertion.setName(name);
        return this;
    }

    @Override
    public XQueryContainsAssertionBuilder allowWildcards() {
        xQueryContainsAssertion.setAllowWildcards(true);
        return this;
    }

    @Override
    public XQueryContainsAssertion build() {
        validateNotEmpty(xQueryContainsAssertion.getXquery(), "Missing XQuery, it's a mandatory parameter for XQueryContainsAssertion");
        validateNotEmpty(xQueryContainsAssertion.getExpectedContent(), "Missing expected content, it's a mandatory parameter for XQueryContainsAssertion");
        xQueryContainsAssertion.setType(Assertions.XQUERY_MATCH_TYPE);
        return xQueryContainsAssertion;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy