title: ExpectedException cause of the cause?
body: <p>I'm trying to verify that all my exceptions are correct. Because values are wrapped in <code>CompletableFutures</code>, the exception thrown is <code>ExecutionException</code> with cause being the exception that I would normally check. Quick example:</p>
  
  <pre><code>void foo() throws A {
    try {
      bar();
    } catch B b {
      throw new A(b);
    }
  }
  </code></pre>
  
  <p>So <code>foo()</code> translates exception thrown by <code>bar()</code>, and all of that is done inside <code>CompletableFutures</code> and <code>AsyncHandlers</code> (I won't copy the whole code, it's just for reference)</p>
  
  <p>In my unit tests I'm making <code>bar()</code> throw an exception and want to check that it's translated correctly when calling <code>foo()</code>:</p>
  
  <pre><code>Throwable b = B("bleh");
  when(mock.bar()).thenThrow(b);
  ExpectedException thrown = ExpectedException.none();
  thrown.expect(ExecutionException.class);
  thrown.expectCause(Matchers.allOf(
                  instanceOf(A.class),
                  having(on(A.class).getMessage(),
                          CoreMatchers.is("some message here")),
          ));
  </code></pre>
  
  <p>So far so good, but I also want to verify that cause of exception <code>A</code> is exception <code>B</code> and <code>having(on(A.class).getCause(), CoreMatchers.is(b))</code> causes <code>CodeGenerationException --&gt; StackOverflowError</code></p>
  
  <p>TL;DR: How do I get cause of cause of expected exception?</p>