Hello Learners!
We discovered a fascinating library which allows us to test our architecture: ArchUnit
We want to share a few cool use cases for the library. We hope you find them intriguing!
Note: slices are sets of related packages. For example, the above test will ensure all packages under domain_package
are free of cycles.
Say you want to specify an architecture rule, but you inherit a legacy codebase which has multiple violations of that rule.
You can record these violations and use FreezingArchRule
to disregard past violations and only enforce the rule in the future.
System.out.println()
and System.err.println()
You can also use ArchUnit as a linter.
Do you have a component diagram that you use to communicate your architecture? How up to date is it?
ArchUnit can turn your PlantUML diagrams into tests!
Now you can be confident that your architecture and your diagram are always in sync.
For example, if you have the following architecture diagram:
then you can ask ArchUnit to run this diagram as a test like so:
The above are only a few examples of what you can achieve with ArchUnit.
For more examples, please visit ArchUnit Test Examples and the official docs.
Have a great weekend!