Search⌘ K
AI Features

Configuring and Testing HTTP Endpoints

Explore how to configure and test HTTP endpoints for a web adapter that exposes domain logic via HTTP API. Learn to write integration tests using Molecule, Undertow, and Gson libraries with a test-driven development approach to ensure correct HTTP request translation and response handling.

In this lesson, we’ll test-drive a web adapter that will provide our domain model with an HTTP API. External web clients will be able to send HTTP requests to this endpoint to trigger actions in our domain model so that we can play the game. The API will return appropriate HTTP responses, indicating the score for the submitted guess and reporting when the game is over.

Clients communicating with the Wordz application through web endpoint
Clients communicating with the Wordz application through web endpoint

The following open-source libraries will be used to help us write the code:

  • Molecule: This is a lightweight HTTP framework.

  • Undertow: This is a lightweight HTTP web server that powers the Molecule framework.

  • GSON: This is a Google library that converts between Java objects and JSON structured data.

To start building, we ...