Hamcrest matcher for list of complex objects with each containing a list of complex objects
<p>Sorry for the long title, but my problem is as follows;</p>

<p>I have these classes;</p>

<pre><code>public class A {
    int a1;
    int a2;
    List&lt;B&gt; listOfB;
}
</code></pre>

<p>and </p>

<pre><code>public class B {
    int b1;
    int b2;
    List&lt;C&gt; listOfC;
}
</code></pre>

<p>and </p>

<pre><code>public class C {
    int c1;
    int c2;
}
</code></pre>

<p>If it were only for <code>B</code> to assert the list of <code>C</code> it has, I would use the following custom matcher;
<code>Matcher&lt;Iterable&lt;C&gt;&gt; cMatcher = Matchers.hasItems(allOf(hasProperty("c1", equalTo(c1)), hasProperty("c2", equalTo(c2))))</code></p>

<p>But how can I do the assertion from <code>A</code>? I want to use this <code>C</code> list matcher in a larger scope matcher that does the following;</p>

<p><code>Matchers.hasItems(allOf(hasProperty("b1", equalTo(b1)), hasProperty("b2", equalTo(b2)), hasProperty("listOfC", cMatcher)))</code></p>

<p>So in a way I wish to match a <code>B</code> in <code>listOfB</code> where has given <code>b1</code>, and <code>b2</code> values, together with its <code>listOfC</code> containing a specific <code>C</code> with values <code>c1</code> and <code>c2</code>.</p>