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

com.smartbear.readyapi.client.assertions.XPathContainsAssertionBuilder 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.XPathContainsAssertion;

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

public class XPathContainsAssertionBuilder extends AbstractAssertionBuilder implements XPathAssertionBuilder {
    private XPathContainsAssertion xPathContainsAssertion = new XPathContainsAssertion();

    XPathContainsAssertionBuilder(String xPath, String expectedContent) {
        xPathContainsAssertion.setXpath(xPath);
        xPathContainsAssertion.setExpectedContent(expectedContent);
    }

    @Override
    public XPathContainsAssertionBuilder allowWildCards() {
        xPathContainsAssertion.setAllowWildcards(true);
        return this;
    }

    @Override
    public XPathContainsAssertionBuilder ignoreComments() {
        xPathContainsAssertion.setIgnoreComments(true);
        return this;
    }

    @Override
    public XPathContainsAssertionBuilder ignoreNamespaces() {
        xPathContainsAssertion.setIgnoreNamespaces(true);
        return this;
    }

    @Override
    public XPathContainsAssertion build() {
        validateNotEmpty(xPathContainsAssertion.getXpath(), "Missing Xpath, it's a mandatory parameter for XPathContainsAssertion");
        validateNotEmpty(xPathContainsAssertion.getExpectedContent(), "Missing expected content, it's a mandatory parameter for XPathContainsAssertion");
        xPathContainsAssertion.setType(Assertions.XPATH_MATCH_TYPE);
        return xPathContainsAssertion;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy