Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Designing Hexagonal Architecture with Java

You're reading from   Designing Hexagonal Architecture with Java An architect's guide to building maintainable and change-tolerant applications with Java and Quarkus

Arrow left icon
Product type Paperback
Published in Jan 2022
Publisher Packt
ISBN-13 9781801816489
Length 460 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Davi Vieira Davi Vieira
Author Profile Icon Davi Vieira
Davi Vieira
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Section 1: Architecture Fundamentals
2. Chapter 1: Why Hexagonal Architecture? FREE CHAPTER 3. Chapter 2: Wrapping Business Rules inside Domain Hexagon 4. Chapter 3: Handling Behavior with Ports and Use Cases 5. Chapter 4: Creating Adapters to Interact with the Outside World 6. Chapter 5: Exploring the Nature of Driving and Driven Operations 7. Section 2: Using Hexagons to Create a Solid Foundation
8. Chapter 6: Building the Domain Hexagon 9. Chapter 7: Building the Application Hexagon 10. Chapter 8: Building the Framework Hexagon 11. Chapter 9: Applying Dependency Inversion with Java Modules 12. Section 3: Becoming Cloud-Native
13. Chapter 10: Adding Quarkus to a Modularized Hexagonal Application 14. Chapter 11: Leveraging CDI Beans to Manage Ports and Use Cases 15. Chapter 12: Using RESTEasy Reactive to Implement Input Adapters 16. Chapter 13: Persisting Data with Output Adapters and Hibernate Reactive 17. Chapter 14: Setting Up Dockerfile and Kubernetes Objects for Cloud Deployment 18. Chapter 15: Good Design Practices for Your Hexagonal Application 19. Assessments 20. Other Books You May Enjoy

Testing the Domain hexagon

To test the Domain hexagon appropriately, we should rely only on its components, ignoring anything coming from other hexagons. After all, these hexagons should depend on the domain and not the other way around. As we have already seen, the Domain hexagon concentrates on the core system logic. It is from that logic we derive the structure and behavior of the Application and Framework hexagons. By building a robust and well-tested Domain hexagon, we're building a solid foundation for the entire system.

Among the operations performed by the topology and inventory system, we can consider adding, removing, and searching network assets as the most important ones. We'll use the following steps to test these operations:

  1. Let's start by seeing how we can test the addition of network equipment, as follows:
    @Test
    public void addNetworkToSwitch(){
        var location = createLocation("US");
        var...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $24.99/month. Cancel anytime