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