The @ArchTest don’t seem to do anything or work. I tried mvn test and it says it sees the file, but with the bad rules I put in there it should not have passed. Doesn’t seem to work.
However integration test does seem to work or at least run. Using mvn -Pintegration-test integration-test.
Not sure how these tests are supposed to run, run them, and there is no docs.
[INFO] Running com.hidden.app.ArchitectureTest
23:27:56.084 [main] INFO com.tngtech.archunit.core.PluginLoader – Detected Java version 22.0.2
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.853 s – in com.hidden.app.ArchitectureTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Thanks. I didn’t add any, just trying to run what it came with out of the box. Oh I edited the ones there, munging package names to see if a fail would occur.
Here is a bad example I also tried.
@ArchTest
public static final ArchRule some_test = classes().that().resideInAPackage("con.hidden").should().bePrivate();
I would recommend to refactore this class. I’ve heard of multiple people in the past that those static archunit sometimes just don’t execute - IDE, Maven, Junit and so on… something just doesn’t line up perfectly in the universe. Using separate normal test method should work 100% of the time and should still be fast enough
It does look like Maven is not running the @ArchTest rules, whereas IntelliJ IDEA does. As @knoobie suggested, I’m refactoring them to be ordinary @Test methods. Will notify you here when the changes are published to start.vaadin.com.