Search⌘ K
AI Features

Streamlining Game Initialization in Wordz

Explore how to connect HTTP requests to the domain layer by parsing JSON using Gson and invoking domain logic in a Java game application. Understand how to use Mockito for creating test doubles to isolate and test the web endpoint, leverage dependency injection, and ensure robust integration through passing tests. Learn the importance of refactoring test code for maintainability after successful integration testing.

Connecting to the domain layer

Our next task is to receive an HTTP request and translate that into domain layer calls. This involves parsing JSON request data using the Google Gson library into Java objects, and then sending that response data to the class Wordz port.

  • We add the code to call the domain layer port implemented as the Wordz class. We’ll ...