/** * Expect that a response header matches the supplied header name and hamcrest matcher. * * @param headerName The name of the expected header * @param expectedValueMatcher The Hamcrest matcher that must conform to the value * @return The builder */ public ResponseSpecBuilder expectHeader(String headerName, Matcher<String> expectedValueMatcher) { spec.header(headerName, expectedValueMatcher); return this; }
/** * Expect that the response status line matches the given String. * * @param expectedStatusLine The expected status line. * @return The builder */ public ResponseSpecBuilder expectStatusLine(String expectedStatusLine) { spec.statusLine(expectedStatusLine); return this; }
/** * Validate that the response time (in milliseconds) matches the supplied <code>matcher</code>. * * @param matcher The matcher * @return the builder */ public ResponseSpecBuilder expectResponseTime(Matcher<Long> matcher) { spec.time(matcher); return this; }
/** * Expect that the response status code matches an integer. * * @param expectedStatusCode The expected status code. * @return The builder */ public ResponseSpecBuilder expectStatusCode(int expectedStatusCode) { spec.statusCode(expectedStatusCode); return this; }
/** * Expect that the response content conforms to one or more Hamcrest matchers. * * @param matcher The hamcrest matcher that must response content must match. * @return The builder */ public ResponseSpecBuilder expectBody(Matcher<?> matcher) { spec.body(matcher); return this; }
/** * Specify the hostname for of the proxy. Will use port {@value #DEFAULT_PORT} and scheme {@value #DEFAULT_SCHEME}. * * @param host The hostname * @return A new ProxySpecification instance */ public static ProxySpecification host(String host) { return new ProxySpecification(host, DEFAULT_PORT, DEFAULT_SCHEME, DEFAULT_USERNAME, DEFAULT_PASSWORD); }
/** * Expect that a response cookie matches the supplied name and value. * * @param cookieName The name of the expected cookie * @param expectedValue The value of the expected cookie * @return The builder */ public ResponseSpecBuilder expectCookie(String cookieName, String expectedValue) { spec.cookie(cookieName, expectedValue); return this; }
/** * Expect that the response content conforms to one or more Hamcrest matchers. * * @param matcher The hamcrest matcher that must response content must match. * @return The builder */ public ResponseSpecBuilder expectContent(Matcher<?> matcher) { spec.content(matcher); return this; }
/** * Set the root path of the response body so that you don't need to write the entire path for each expectation. The same as {@link #rootPath(String)} * but also provides a way to defined arguments. * * @param rootPath The root path to use. * @param arguments The arguments. * @see ResponseSpecification#rootPath(String, java.util.List) */ public ResponseSpecBuilder rootPath(String rootPath, List<Argument> arguments) { spec.rootPath(rootPath, arguments); return this; }
/** * Creates a new proxy selector route planner. * * @param schemeRegistry the scheme registry * @param proxySelector the proxy selector */ public RestAssuredProxySelectorRoutePlanner(SchemeRegistry schemeRegistry, ProxySelector proxySelector, ProxySpecification proxySpecification) { super(schemeRegistry, proxySelector); this.scheme = proxySpecification == null ? null : proxySpecification.getScheme(); }
public static Argument withArg(Object arg) { return new Argument(arg); }
/** * Expect that the response status code matches the given Hamcrest matcher. * * @param expectedStatusCode The expected status code matcher. * @return The builder */ public ResponseSpecBuilder expectStatusCode(Matcher<Integer> expectedStatusCode) { spec.statusCode(expectedStatusCode); return this; }
/** * Expect that a response header matches the supplied name and value. * * @param headerName The name of the expected header * @param expectedValue The value of the expected header * @return The builder */ public ResponseSpecBuilder expectHeader(String headerName, String expectedValue) { spec.header(headerName, expectedValue); return this; }
/** * Expect that the response status line matches the given Hamcrest matcher. * * @param expectedStatusLine The expected status line matcher. * @return The builder */ public ResponseSpecBuilder expectStatusLine(Matcher<String> expectedStatusLine) { spec.statusLine(expectedStatusLine); return this; }
/** * Specify the scheme of the proxy. * * @param scheme The scheme of the proxy. * @return A new ProxySpecification instance */ public ProxySpecification withScheme(String scheme) { return new ProxySpecification(host, port, scheme); }
/** * Validate that the response time matches the supplied <code>matcher</code> and time unit. * * @param matcher The matcher * @param timeUnit The timeout * @return the builder */ public ResponseSpecBuilder expectResponseTime(Matcher<Long> matcher, TimeUnit timeUnit) { spec.time(matcher, timeUnit); return this; }
/** * Expect that a cookie exist in the response, regardless of value (it may have no value at all). * * @param cookieName the cookie to validate that it exists * @return the builder */ public ResponseSpecBuilder expectCookie(String cookieName) { spec.cookie(cookieName); return this; }
/** * Specify the port of the proxy. Will use hostname {@value #DEFAULT_HOST} and scheme {@value #DEFAULT_SCHEME}. * * @param port The port on localhost to connect to. * @return A new ProxySpecification instance */ public static ProxySpecification port(int port) { return new ProxySpecification(DEFAULT_HOST, port, DEFAULT_SCHEME, DEFAULT_USERNAME, DEFAULT_PASSWORD); }
/** * Specify the port of the proxy. * * @param port The port of the proxy. * @return A new ProxySpecification instance */ public ProxySpecification withPort(int port) { return new ProxySpecification(host, port, scheme, username, password); }
/** * Specify the hostname of the proxy. * * @param host The hostname of the proxy. * @return A new ProxySpecification instance */ public ProxySpecification withHost(String host) { return new ProxySpecification(host, port, scheme, username, password); }