title: Adding Custom Messages to JUnit4 Style Exception Tests
body: <p>I have the following test:</p>
  
  <pre><code>@Test(expected=ArithmeticException.class) 
     public void divideByZero() {
     int n = 2 / 1;
  }
  </code></pre>
  
  <p>as seen <a href="http://www.ibm.com/developerworks/java/library/j-junit4.html" rel="nofollow">here</a>.</p>
  
  <p>I would like to add a message that will print if this test fails.</p>
  
  <p>For instance if I was doing an Assertion test, I would do the following to add a message:</p>
  
  <pre><code>@Test public void assertFail(){
      Assert.fail("This is the error message I want printed.");
      Assert.assertEquals(true, false);
  }
  </code></pre>
  
  <p>The second example should print out "This is the error message I want printed.".  How do I set the first example message text?</p>