I'm using ArchUnit and I want to check if all classes residing in a package declare one only public method called execute. I have this code:
JavaClasses importedClasses = new ClassFileImporter().importPackages("my.package");
methods().that().arePublic().should().haveName("execute").check(importedClasses);
It works but I would like this test to fail when execute method is absent in any class. With my code, test passes because all public methods (zero) actually have name "execute".