Assets 2

Important

The Maven coordinates for com.tngtech.archunit:archunit-junit have changed, since there is now support for JUnit 4 and JUnit 5. The new coordinates for the equivalent artifact are now

com.tngtech.archunit:archunit-junit4:0.9.0

Enhancements

Core

  • archunit-ignore-patterns.txt can now contain comments (see #88; many thanks to @bedla)

  • a JavaClass' directDependenciesFromSelf and directDependenciesToSelf now contain further dependencies. This affects many rules as well, like layeredArchitecture() which might now detect more violations than before. In particular dependencies now contain dependencies from

    • fields of a certain type
    • method/constructor parameters of a certain type
    • method return types

    (see #92 and #96; many thanks to @msherman32)

  • the plugin mechanism activating Java >= 9 support now supports EA versions (see #93; many thanks to @jqno)

Lang

  • the rule API now supports a concise way to assert properties of a single class (see #60; many thanks to @msherman32)
  • the rule API can now assert that classes haveOnlyFinalFields() (see #86; many thanks to @bgalek)
  • the rule API now allows to assert that there are at least / at most / exactly x classes matched by a rule (see #83; many thanks to @bedla)
  • rules can now be derived from PlantUML component diagrams (compare the User Guide; see #4; many thanks to @msherman32)
  • the rule API now allows to check more general for dependencies instead of just accesses (like interfaces, field types, method parameters, ...) (see #69)
  • the rule API now includes several methods to restrict what classes should "only" do, i.e. classes().should().onlyDependOnClassesThat()... or onlyCallMethodsThat(..), etc. (see #84)

JUnit

  • ArchUnit now offers extended JUnit 5 support (compare the User Guide; see #34)

Kotlin

  • rule suits with JUnit 4 / JUnit 5 can now be written in a concise way and source locations are reported correctly (compare the User Guide; see #77)