I wrote some ArchUnit-Tests using Jupiter. I found examples that indicated, you can write your ArchUnit tests using non static methods, like:
@Test
void enforceExceptionNames() {
classes().that()
.areAssignableTo(Exception.class)
.and(modifier(PUBLIC))
.and().areNotAnnotatedWith("some.qa.ExceptionNameFlaw")
.should()
.haveNameMatching(".*Exception").orShould()
.haveNameMatching(".*Error")
.check(modulClasses);
}
The advantage is, that you can do things that arent possible static - like extracting the packagename using reflection at runtime and other stuff.
But performance is poor. Like 1-10 seconds depending on size.
Eitherway ArchUnit states to have all Classes cached static.