Unit Test Your Java Architecture With ArchUnit – Roland Weisleder | IntelliJ IDEA Tech Talks

In this episode of IntelliJ IDEA Tech Talks, I speak with Roland Weisleder about ArchUnit, a way to enforce your architecture through unit tests.

Description

Are your architecture and code drifting apart? Is the implementation of non-functional requirements and cross-cutting concerns often forgotten? Do you have too much spaghetti code due to circular dependencies? These things happen far too often and will quickly lead to an unmaintainable code base. In the Java ecosystem, the library ArchUnit can help in this situation. In this episode we will look at how we can use ArchUnit to test our architecture within unit tests and finally get structure back into the system. You can use ArchUnit to enforce architecture rules and practices for anyone working on your codebase, including agents.

Chapters

  • 00:00:00 – Intro
  • 00:02:39 – What is ArchUnit?
  • 00:04:32 – Adding ArchUnit to a project in IntelliJ IDEA
  • 00:06:47 – Enforcing naming conventions
  • 00:13:27 – Testing dependencies between modules
  • 00:15:57 – Catching circular dependencies
  • 00:21:16 – Technical dependencies, for example: layered architecture rules 00:24:21 – Introducing ArchUnit into a legacy codebase
  • 00:30:30 – Freezing existing violations
  • 00:35:17 – Using predefined rules
  • 00:38:06 – Sharing rules across multiple projects
  • 00:40:51 – Is ArchUnit still relevant with AI agents?

Links

Other episodes