From 84dcb64cf07eba08fd7ef4de3a6aaf21f4944157 Mon Sep 17 00:00:00 2001 From: Stefan Birkner Date: Wed, 29 Jan 2014 01:07:02 +0100 Subject: [PATCH] Add reference to ExpectedException. Fixes #806. The ExpectedException can be used for better exception testing. The reference should guide the reader to its documentation. --- src/main/java/org/junit/Test.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/junit/Test.java b/src/main/java/org/junit/Test.java index 9687ffdbb6cc..71ac4287dbef 100644 --- a/src/main/java/org/junit/Test.java +++ b/src/main/java/org/junit/Test.java @@ -31,7 +31,11 @@ * @Test(expected=IndexOutOfBoundsException.class) public void outOfBounds() { * new ArrayList<Object>().get(1); * } - *

+ * + * If the exception's message or one of its properties should be verified, the + * {@link org.junit.rules.ExpectedException ExpectedException} rule can be used. Further + * information about exception testing can be found at the + * JUnit Wiki. *

* The second optional parameter, timeout, causes a test to fail if it takes * longer than a specified amount of clock time (measured in milliseconds). The following test fails: @@ -73,7 +77,9 @@ private None() { /** * Optionally specify expected, a Throwable, to cause a test method to succeed if - * and only if an exception of the specified class is thrown by the method. + * and only if an exception of the specified class is thrown by the method. If the Throwable's + * message or one of its properties should be verified, the + * {@link org.junit.rules.ExpectedException ExpectedException} rule can be used instead. */ Class expected() default None.class;