Skip to main content

ArchUnit

Simple Story

ArchUnit reads the pupil's compiled answer and checks statements about how its parts refer to one another, without running any of it.

It is very good at "does this class mention that class at all?" and it cannot answer "which file does this call open?", because that value only exists once the pupil is working.

What it is

ArchUnit is a Java library for asserting architectural rules. It imports compiled classes into its own model and evaluates fluent rules over them, as ordinary unit tests.

How Ares 2 uses it

ArchUnit is one of the two interchangeable engines behind the architecture layer, selected by the ARCHUNIT half of the programming language configuration. It analyses dependencies: which types the student's classes refer to.

What it cannot see

Dependency analysis is coarse. It establishes that student code refers to a file-writing application programming interface (API); it does not establish which path is written, because the path is a runtime value.

That is not a defect, it is the division of labour. The architecture layer rejects what can be decided statically, and the aspect-oriented programming (AOP) layer decides the rest at the moment of the call, where the arguments exist. Neither layer is sufficient alone, which is why Ares runs both and continuous integration (CI) exercises all four combinations.

Further reading