3

I wish I could define an arch rule prohibiting that classes catch a given exception type. Something like the rule below:

noClasses()
    .that()
    .resideOutsideOfPackage("..repository..")
    .should()
    .catchExceptions()
    .that()
    .areAssignableTo(SQLException.class)

Is there a way to do that in ArchUnit?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
EijiAdachi
  • 441
  • 1
  • 3
  • 15
  • 2
    Currently, it's not possible to check the internals of methods. Therefore exists an open issue: https://github.com/TNG/ArchUnit/issues/260 Feel free to vote for this issue. – Roland Weisleder Apr 22 '20 at 06:32

0 Answers0