MCPcopy Create free account
hub / github.com/TNG/ArchUnit-Examples

github.com/TNG/ArchUnit-Examples @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
1,273 symbols 2,254 edges 563 files 20 documented · 2% updated 21d ago★ 644

Browse by type

Functions 765 Types & classes 508
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ArchUnit Examples

This module presents some examples on how to use the latest release of ArchUnit.

The different subprojects demonstrate the type of test support: * example-junit4 shows how to use the JUnit 4 test support including the ArchUnitRunner * example-junit5 shows how to use the JUnit 5 test support where test classes are simply being picked up by being annotated with @AnalyzeClasses * example-junit6 shows how to use the JUnit 6 test support where test classes are simply being picked up by being annotated with @AnalyzeClasses * example-plain shows how to use ArchUnit independently of any specific test framework, even though as a runtime environment these tests use JUnit 4 as well

All example rules you find within src/test refer to classes from src/main. These tests are all designed to fail, to demonstrate how production code could violate typical architectural constraints (like layer dependencies).

You can run them

  • with Gradle (using the provided build.gradle scripts): sh ./gradlew test
  • with Maven (using the provided pom.xml files in the same directories): sh ./mvnw test
  • or directly from your IDE.

Regarding issues

If you have found any issues with the examples or have any question, please direct them to the main repository instead. This repository is an autogenerated version of the latest released version of https://github.com/TNG/ArchUnit/tree/main/archunit-example (with some simplified project setup for illustration)

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Method 765
Class 442
Interface 57
Enum 9

Languages

Java100%

Modules by API surface

example-plain/src/test/java/com/tngtech/archunit/exampletest/ModulesTest.java16 symbols
example-plain/src/test/java/com/tngtech/archunit/exampletest/CyclicDependencyRulesTest.java13 symbols
example-junit5/src/test/java/com/tngtech/archunit/exampletest/junit5/SessionBeanRulesTest.java12 symbols
example-junit4/src/test/java/com/tngtech/archunit/exampletest/junit4/SessionBeanRulesTest.java12 symbols
example-plain/src/test/java/com/tngtech/archunit/exampletest/SessionBeanRulesTest.java9 symbols
example-plain/src/test/java/com/tngtech/archunit/exampletest/LayerDependencyRulesTest.java9 symbols
example-plain/src/test/java/com/tngtech/archunit/exampletest/CodingRulesTest.java9 symbols
example-junit5/src/test/java/com/tngtech/archunit/exampletest/junit5/ModulesTest.java9 symbols
example-junit4/src/test/java/com/tngtech/archunit/exampletest/junit4/ModulesTest.java9 symbols
example-plain/src/test/java/com/tngtech/archunit/exampletest/extension/NewConfigurationEvent.java7 symbols
example-plain/src/test/java/com/tngtech/archunit/exampletest/extension/ExampleExtension.java7 symbols
example-plain/src/test/java/com/tngtech/archunit/exampletest/ControllerRulesTest.java7 symbols

For agents

$ claude mcp add ArchUnit-Examples \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page