O'Reilly logo
live online training icon Live Online training

Testable Architecture with Java, JUnit, and Spring

Learn how to create testable, verifiable architecture using Spring

Topic: Software Development
Jakub Pilimon

Many companies fail at unit and integration testing because the architecture of their systems doesn’t fit their needs. As complexity increases, it’s really hard to verify some behaviors. And even if you somehow manage to do so, your testing suite becomes tightly coupled to the implementation and brittle. It doesn’t offer safety. It doesn’t eliminate the fear of adding new code. The solution is to learn how to refactor and design your model accordingly, creating testable architectures that are both safe and well structured.

Join expert Jakub Pilimon to learn the basics of testable architectures. Along the way, you’ll explore the anatomy of good unit tests (JUnit) and discover how to use Spring to test legacy code, as well as the data layer, the web layer, and messaging.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • How to properly unit-test your domain model
  • How to properly test your application process
  • How not to mix domain logic with application logic
  • How to refactor legacy systems
  • Testable architecture

And you’ll be able to:

  • Ensure your components are loosely coupled (and test it)
  • Create well-structured applications that will pass testing and work in production
  • Use Spring to test the data layer, the web layer, and messaging

This training course is for you because...

  • You’re a midlevel or senior Java developer.
  • You work with complex applications.
  • You want to become familiar with testing on different levels.


  • Intermediate knowledge of Java
  • Familiarity with Spring, JUnit, and Git
  • A computer with Git, JDK 11+, Maven, and your favorite IDE installed

Recommended preparation:

  • Clone the course project (link to come)

Recommended follow-up:

About your instructor

  • Jakub Pilimon is Staff Technologist and Architect at Pivotal. He also works as a trainer and consultant for Bottega IT MINDS. Author of github.com/ddd-by-examples open source projects and co-author of “DNA” - the best selling IT course in the Polish market. Jakub frequently speaks at meetups and conferences about architecture, testing, refactoring and Domain-Driven Design.


The timeframes are only estimates and may vary according to how the class is progressing

Cohesion and coupling: Part 1 (55 minutes)

  • Live coding demonstration: Problems with a wrong architecture (white box testing); anatomy of a good unit test
  • Q&A

Break (5 minutes)

Cohesion and coupling: Part 2 (55 minutes)

  • Presentation: Correcting the architecture
  • Group discussion: What’s the conclusion?
  • Hands-on exercise: Improve the cohesion and coupling
  • Q&A

Break (5 minutes)

Testing the legacy code with Spring (55 minutes)

  • Live coding demonstration: Problems with unit testing in legacy systems; integration testing with Spring
  • Presentation: Refactoring the architecture
  • Group discussion: What’s the conclusion?
  • Q&A

Break (5 minutes)

Spring tooling (55 minutes)

  • Live coding demonstration: Testing messaging with Spring; testing data access with Spring; testing the web layer with Spring
  • Hands-on exercise: Implement data access tests using Spring

Wrap-up and Q&A (5 minutes)