liveBook · Manning

TestHTTPEndpoint annotation

As explained in Quarkus in Action

A Quarkus test annotation that provides the URL of a specified REST endpoint during a test run.

TestHTTPEndpoint supplies the URL of a chosen REST endpoint during a Quarkus test. Combine it with TestHTTPResource to inject a URL that can be passed to RestAssured when building requests. section 5.2.1

A typical endpoint test uses the annotation to:

  • Associate the injected URL with a resource class such as ReservationResource. section 5.2.1
  • Submit a JSON request through RestAssured to the reservation endpoint. section 5.2.1
  • Verify the returned reservation, including its assigned identifier. section 5.2.1

Reservation resource test

Annotate a URL field with @TestHTTPEndpoint(ReservationResource.class) and @TestHTTPResource, then pass reservationResource to RestAssured while testing the POST /reservation operation. The test creates a reservation and checks that the response contains an assigned ID.

How Quarkus in Action covers it

How deep it goes
Explains annotation-based URL injection and its non-CDI behavior, but defers broader test setup details.
Examples
Demonstrates ReservationResource testing with a JSON POST to /reservation and an assigned-ID assertion.
What it assumes
Assumes familiarity with Quarkus tests, REST resources, JSON requests, and RestAssured.
What you can do after
Apply it via TestHTTPResource and RestAssured to exercise a specified REST endpoint in JVM or native tests.
How it connects
Connects Quarkus testing with REST endpoints, TestHTTPResource, RestAssured, and native testing.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quarkus in Action. The section links point to the parts of the book it draws on.