class ProductTest @Test void productCannotHaveNegativePrice() assertThrows(IllegalArgumentException.class, () -> new Product("1", "Laptop", new Money(-10, "USD")));
Elias leaned in. The PDF used a Java analogy. In a layered app, your UserService likely extended a JpaRepository . If the database went down, the service died. The business logic was held hostage by the infrastructure.
Elias scrolled down to the diagrams. It wasn't literally about hexagons; it was about geometry. A hexagon has six sides, but the shape merely represented the boundary between the inside and the outside.
public class UserServiceImpl implements UserService @Override public User getUser(Long id) // Business logic to get user return new User(id, "John Doe");
public UserApplication(UserRepository userRepository) this.userRepository = userRepository;
The author showed a diagram where the "Driving Adapter" switched from a REST Controller to a CLI Command Line tool. The domain didn't change. Then, the "Driven Adapter" switched from a SQL Database to a NoSQL store. The domain still didn't change.