title: How to check dependencies in generics with ArchUnitTest?
body: <p>We have a rule that package &quot;foo&quot; should not depend on package &quot;bar&quot;</p>
  <pre><code>noClasses()
                  .that()
                  .resideInAPackage(&quot;com.foo..&quot;)
                  .should()
                  .dependOnClassesThat(resideInAPackage(&quot;com.bar..&quot;))
                  .check(javaClasses);
  </code></pre>
  <p>And we have an interface in &quot;foo&quot; using &quot;bar&quot; in two ways, directly and via generics.</p>
  <pre><code>public interface IFoo {
  
      BarClass getBar();
  
      Optional&lt;BarClass&gt; getOptionalBar();
  
      List&lt;BarClass&gt; getListBar();
  }
  </code></pre>
  <p>The &quot;BarClass getBar();&quot; is caught by ArchUnitTest, but &quot;Optional getOptionalBar()&quot; and &quot;List getListBar()&quot; doesn't give us any error in the test. Does anybody know how to make them failing too?</p>