com.smartbear.readyapi.client.assertions.JsonPathContentAssertionBuilder 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.JsonPathContentAssertion;
import static com.smartbear.readyapi.client.Validator.validateNotEmpty;
public class JsonPathContentAssertionBuilder extends AbstractAssertionBuilder implements JsonPathAssertionBuilder {
private JsonPathContentAssertion jsonPathContentAssertion = new JsonPathContentAssertion();
JsonPathContentAssertionBuilder(String jsonPath, String expectedContent) {
jsonPathContentAssertion.setJsonPath(jsonPath);
jsonPathContentAssertion.setExpectedContent(expectedContent);
}
@Override
public JsonPathAssertionBuilder allowWildcards() {
jsonPathContentAssertion.setAllowWildcards(true);
return this;
}
@Override
public JsonPathContentAssertion build() {
validateNotEmpty(jsonPathContentAssertion.getJsonPath(), "Missing JSON path, it's a mandatory parameter for JsonPathContentAssertion");
validateNotEmpty(jsonPathContentAssertion.getExpectedContent(), "Missing expected content, it's a mandatory parameter for JsonPathContentAssertion");
jsonPathContentAssertion.setType(Assertions.JSON_PATH_MATCH_TYPE);
return jsonPathContentAssertion;
}
public final static JsonPathContentAssertion create(){
JsonPathContentAssertion assertion = new JsonPathContentAssertion();
assertion.setType(Assertions.JSON_PATH_MATCH_TYPE);
return assertion;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy