Before you rehearse any of this: check the version. In August 2026, REST Assured’s current release on Maven Central was 6.0.1, published 2026-07-10. A 4.4.0 entry in pom.xml is two major versions behind, and the 5.x-to-6.x jump changed the Java baseline. I read the class file headers out of three released jars:
rest-assured 4.4.0: io/restassured/RestAssured.class class-file major version 52 (Java 8)
rest-assured 5.5.7: io/restassured/RestAssured.class class-file major version 52 (Java 8)
rest-assured 6.0.1: io/restassured/RestAssured.class class-file major version 61 (Java 17)
So the honest answer to “what does REST Assured need?” is: 5.x runs on Java 8, 6.x needs Java 17 or newer. From the 6.0.1 POM its own key dependencies are Groovy 5.0.3 and Apache HttpClient 4.5.13; if an interviewer asks whether it has moved to HttpClient 5, the answer in August 2026 was no. Maven Central supplies the release number, the three jar headers and the pinned dependency versions, which rest-assured-interview-questions.sh re-reads before it compiles the examples below against 6.0.1 and runs them against two stubs on loopback, one behind a self-signed certificate; it needs JDK 17 or newer, python3, curl and openssl, and reports SKIP for whatever it cannot run.
The eight answers worth having
1. What is the dependency?
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>6.0.1</version>
<scope>test</scope>
</dependency>
Note <scope>test</scope>. It is a test library; it has no business on your production classpath.
2. What do given/when/then actually do? given() builds the request specification, when() issues the call, then() asserts on the response. Here it is running against a local stub, output pasted:
[1] given/when/then on GET /api/widget
OK
[2] extract + chain
id=7 Location=/api/widget/8 echo.ref=7
The code behind [1] chains four assertions — statusCode(200), contentType("application/json"), body("name", equalTo("widget")), body("tags.size()", equalTo(2)). tags.size() is worth memorising: the argument to body() is a Groovy GPath expression, not a JSONPath one, which is why method calls work inside it.
3. What does a failed assertion look like? Interviewers ask this to find out whether you have ever actually debugged one. Measured:
1 expectation failed.
JSON path name doesn't match.
Expected: gadget
Actual: widget
Four lines, and the third and fourth are the ones you read first. It is an AssertionError, not an exception — which is why REST Assured works under any test runner without an adapter.
4. Basic auth — and the trap. given().auth().basic("username", "password") is challenged authentication: the credentials are only sent after the server answers 401 with a WWW-Authenticate header. Plenty of APIs return a bare 401 instead, and then the same code silently fails. Three runs against the same stub:
auth().basic() vs server WITHOUT WWW-Authenticate -> 1 expectation failed. Expected status code <200> but was <401>.
auth().basic() vs server WITH WWW-Authenticate -> 200 OK
auth().preemptive().basic() vs server WITHOUT WWW-Authenticate -> 200 OK
Use auth().preemptive().basic(...) unless you specifically want to exercise the challenge. This is the single most useful thing on this page.
5. JSON schema validation. body(matchesJsonSchema(schema)) with only the rest-assured dependency does not compile. I unpacked the jar: rest-assured-6.0.1.jar contains zero entries matching JsonSchemaValidator. The class lives in a separate artifact:
io/restassured/module/jsv/JsonSchemaValidator.class (in io.rest-assured:json-schema-validator)
Add io.rest-assured:json-schema-validator and import io.restassured.module.jsv.JsonSchemaValidator.matchesJsonSchema.
6. XML responses. Set the content type so the XmlPath parser is selected — given().accept(ContentType.XML) — and remember GPath addresses XML from the root element, so a document rooted at <response> is reached as body("response.key", equalTo("value")).
7. Response times. then().time(lessThan(2000L)) is real API, but as an interview answer say what it measures: wall clock for the whole exchange, including connection setup. Asserting a millisecond threshold in CI produces flaky tests on somebody else’s network. Record the time; assert on it only against infrastructure you control.
8. What is the correct answer to “how do I fix SSL errors”? See below.
Do not answer “use relaxedHTTPSValidation()”
RestAssured.useRelaxedHTTPSValidation(); is not handling certificate validation. It is turning it off. I put a Java HTTP server behind a self-signed certificate and ran the same request twice:
[5] HTTPS against a self-signed cert, WITHOUT relaxed validation
javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[6] same request WITH relaxedHTTPSValidation()
OK - certificate was never checked
The certificate was not merely “self-signed and therefore allowed” — it was not examined. Any certificate presented by anything on that connection is accepted, including one from an interception proxy sitting between your test runner and a staging environment that holds real data. If a test suite carries useRelaxedHTTPSValidation() at class level, it can no longer detect that it is talking to the wrong host at all. Import the environment’s CA into a trust store and point REST Assured at it with trustStore(...). Reach for the relaxed setting only for a disposable stub on loopback, and scope it to that single request, never to RestAssured.config.
What I did not check
Every fragment above ran against a local stub on loopback, not against a real API, and on one JDK (26.0.2) and one REST Assured version (6.0.1). I did not test OAuth, multipart upload, filters, the Kotlin or Spring MockMvc modules, or behaviour on Java 17 and 21 — a 6.x jar will load on those, but I have not run it there. If your interview is for a JUnit 4 shop, note that REST Assured itself is framework-agnostic: it produces AssertionError, which any runner reports. That is worth saying out loud, because the framework question is usually really a TestNG question and has nothing to do with this library. The project’s own usage guide is the reference to cite; for the JDK side, see what the Java distributions actually differ on.