TNG / ArchUnit

A Java architecture test library, to specify and assert architecture rules in plain Java
http://archunit.org
Apache License 2.0
3.17k stars 287 forks source link

Layer dependency rule ignores "catch" blocks #1232

Open vprudnikov opened 7 months ago

vprudnikov commented 7 months ago

Hi!

I have a rule that verifies dependency between layers:

...
.whereLayer(LAYER_INFRASTRUCTURE).mayNotBeAccessedByAnyLayer()
...

The problem is that it doesn't work with catch blocks defined in other layers.

If I use an exception like this: MyException ex = new MyException ("you will be caught"); then ArchUnit catches it.

However, if I use a catch block like so: } catch (MyException e) { then ArchUnit simply ignores it.