title: Using junit @Rule, expectCause() and hamcrest matchers
body: <p>I have a test:</p>
  
  <pre><code>@Rule
  public ExpectedException thrown = ExpectedException.none();
  ...
  @Test
  public void testMethod()
  {
      final String error = "error message";
      Throwable expectedCause = new IllegalStateException(error);
      thrown.expectCause(org.hamcrest.Matchers.&lt;Throwable&gt;equalTo(expectedCause));
      someServiceThatTrowsException.foo();
  }
  </code></pre>
  
  <p>When run via mvn the test method, I'm getting the error:</p>
  
  <blockquote>
    <p>java.lang.NoSuchMethodError:
    org.junit.rules.ExpectedException.expectCause(Lorg/hamcrest/Matcher;)V</p>
  </blockquote>
  
  <p>Test compiles fine.</p>
  
  <p>Please help me, cannot understand how to test the cause of the exception?</p>