From: David S. <ds...@us...> - 2006-03-10 00:52:19
|
Update of /cvsroot/junit/junit/org/junit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1356/org/junit Modified Files: After.java Before.java Assert.java ComparisonFailure.java AfterClass.java Log Message: Patched javadoc, thanks to Matthias Schmidt RunWith is @Inherited Added acknowledgements to-do is up to date Index: After.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/After.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- After.java 15 Feb 2006 22:55:30 -0000 1.2 +++ After.java 10 Mar 2006 00:52:15 -0000 1.3 @@ -6,10 +6,10 @@ import java.lang.annotation.Target; /** - * If you allocate external resources in a <code>@Before</code> method you need to release them + * If you allocate external resources in a {@link org.junit.Before} method you need to release them * after the test runs. Annotating a <code>public void</code> method - * with <code>@After</code> causes that method to be run after the <code>@Test</code> method. All <code>@After</code> - * methods are guaranteed to run even if a <code>@Before</code> or <code>@Test</code> method throws an + * with <code>@After</code> causes that method to be run after the {@link org.junit.Test} method. All <code>@After</code> + * methods are guaranteed to run even if a {@link org.junit.Before} or {@link org.junit.Test} method throws an * exception. The <code>@After</code> methods declared in superclasses will be run after those of the current * class. * <p> @@ -30,6 +30,7 @@ * </code> * * @see org.junit.Before + * @see org.junit.Test */ @Retention(RetentionPolicy.RUNTIME) Index: Before.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/Before.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Before.java 15 Feb 2006 22:55:30 -0000 1.2 +++ Before.java 10 Mar 2006 00:52:15 -0000 1.3 @@ -8,7 +8,7 @@ /** * When writing tests, it is common to find that several tests need similar * objects created before they can run. Annotating a <code>public void</code> method - * with <code>@Before</code> causes that method to be run before the <code>@Test</code> method. + * with <code>@Before</code> causes that method to be run before the {@link org.junit.Test} method. * The <code>@Before</code> methods of superclasses will be run before those of the current class. * <p> * Here is a simple example: Index: Assert.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/Assert.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Assert.java 15 Feb 2006 22:55:30 -0000 1.2 +++ Assert.java 10 Mar 2006 00:52:15 -0000 1.3 @@ -9,18 +9,23 @@ * ...<br> * assertEquals(...);<br> * </code> + * + * @see java.lang.AssertionError */ - public class Assert { /** * Protect constructor since it is a static only class */ protected Assert() { } + + // TODO: param comments should start with lower case letters /** * Asserts that a condition is true. If it isn't it throws an - * AssertionError with the given message. + * {@link AssertionError} with the given message. + * @param message the identifying message or <code>null</code> for the {@link AssertionError} + * @param condition condition to be checked */ static public void assertTrue(String message, boolean condition) { if (!condition) @@ -29,7 +34,8 @@ /** * Asserts that a condition is true. If it isn't it throws an - * AssertionError. + * {@link AssertionError} without a message. + * @param condition condition to be checked */ static public void assertTrue(boolean condition) { assertTrue(null, condition); @@ -37,7 +43,9 @@ /** * Asserts that a condition is false. If it isn't it throws an - * AssertionError with the given message. + * {@link AssertionError} with the given message. + * @param message the identifying message or <code>null</code> for the {@link AssertionError} + * @param condition condition to be checked */ static public void assertFalse(String message, boolean condition) { assertTrue(message, !condition); @@ -45,7 +53,8 @@ /** * Asserts that a condition is false. If it isn't it throws an - * AssertionError. + * {@link AssertionError} without a message. + * @param condition condition to be checked */ static public void assertFalse(boolean condition) { assertFalse(null, condition); @@ -53,6 +62,8 @@ /** * Fails a test with the given message. + * @param message the identifying message or <code>null</code> for the {@link AssertionError} + * @see AssertionError */ static public void fail(String message) { throw new AssertionError(message); @@ -67,7 +78,10 @@ /** * Asserts that two objects are equal. If they are not, an - * AssertionError is thrown with the given message. + * {@link AssertionError} is thrown with the given message. + * @param message the identifying message or <code>null</code> for the {@link AssertionError} + * @param expected expected value + * @param actual actual value */ static public void assertEquals(String message, Object expected, Object actual) { if (expected == null && actual == null) @@ -82,7 +96,9 @@ /** * Asserts that two objects are equal. If they are not, an - * AssertionError is thrown. + * {@link AssertionError} without a message is thrown. + * @param expected expected value + * @param actual the value to check against <code>expected</code> */ static public void assertEquals(Object expected, Object actual) { assertEquals(null, expected, actual); @@ -90,7 +106,10 @@ /** * Asserts that two object arrays are equal. If they are not, an - * AssertionError is thrown with the given message. + * {@link AssertionError} is thrown with the given message. + * @param message the identifying message or <code>null</code> for the {@link AssertionError} + * @param expecteds Object array or array of arrays (multi-dimensional array) with expected values + * @param actuals Object array or array of arrays (multi-dimensional array) with actual values */ public static void assertEquals(String message, Object[] expecteds, Object[] actuals) { if (expecteds == actuals) @@ -117,7 +136,9 @@ /** * Asserts that two object arrays are equal. If they are not, an - * AssertionError is thrown. + * {@link AssertionError} is thrown. + * @param expecteds Object array or array of arrays (multi-dimensional array) with expected values + * @param actuals Object array or array of arrays (multi-dimensional array) with actual values */ public static void assertEquals(Object[] expecteds, Object[] actuals) { assertEquals(null, expecteds, actuals); @@ -125,10 +146,15 @@ /** * Asserts that two doubles are equal to within a positive delta. If they - * are not, an AssertionError is thrown with the given message. If the + * are not, an {@link AssertionError} is thrown with the given message. If the * expected value is infinity then the delta value is ignored. NaNs are * considered equal: - * assertEquals(Double.NaN, Double.NaN, *) passes + * <code>assertEquals(Double.NaN, Double.NaN, *)</code> passes + * @param message the identifying message or <code>null</code> for the {@link AssertionError} + * @param expected expected value + * @param actual the value to check against <code>expected</code> + * @param delta the maximum delta between <code>expected</code> and <code>actual</code> for which + * both numbers are still considered equal. */ static public void assertEquals(String message, double expected, double actual, double delta) { if (Double.compare(expected, actual) == 0) @@ -139,10 +165,14 @@ /** * Asserts that two doubles are equal to within a positive delta. If they - * are not, an AssertionError is thrown. If the + * are not, an {@link AssertionError} is thrown. If the * expected value is infinity then the delta value is ignored.NaNs are * considered equal: - * assertEquals(Double.NaN, Double.NaN, *) passes + * <code>assertEquals(Double.NaN, Double.NaN, *)</code> passes + * @param expected expected value + * @param actual the value to check against <code>expected</code> + * @param delta the maximum delta between <code>expected</code> and <code>actual</code> for which + * both numbers are still considered equal. */ static public void assertEquals(double expected, double actual, double delta) { assertEquals(null, expected, actual, delta); @@ -150,10 +180,15 @@ /** * Asserts that two floats are equal to within a positive delta. If they - * are not, an AssertionError is thrown with the given message. If the + * are not, an {@link AssertionError} is thrown with the given message. If the * expected value is infinity then the delta value is ignored.NaNs are * considered equal: - * assertEquals(Float.NaN, Float.NaN, *) passes + * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes + * @param message the identifying message or <code>null</code> for the {@link AssertionError} + * @param expected the expected float value + * @param actual the float value to check against <code>expected</code> + * @param delta the maximum delta between <code>expected</code> and <code>actual</code> for which + * both numbers are still considered equal. */ static public void assertEquals(String message, float expected, float actual, float delta) { if (Float.compare(expected, actual) == 0) @@ -164,42 +199,52 @@ /** * Asserts that two floats are equal to within a positive delta. If they - * are not, an AssertionError is thrown. If the - * expected value is infinity then the delta value is ignored.NaNs are + * are not, an {@link AssertionError} is thrown. If the + * expected value is infinity then the delta value is ignored. {@link Float#NaN NaNs} are * considered equal: - * assertEquals(Float.NaN, Float.NaN, *) passes + * <code>assertEquals(Float.NaN, Float.NaN, *)</code> passes + * @param expected the expected value + * @param actual the value to check against <code>expected</code> + * @param delta the maximum delta between <code>expected</code> and <code>actual</code> for which + * both numbers are still considered equal. */ static public void assertEquals(float expected, float actual, float delta) { assertEquals(null, expected, actual, delta); } /** - * Asserts that an object isn't null. If it is an AssertionError is + * Asserts that an object isn't null. If it is an {@link AssertionError} is * thrown with the given message. + * @param message the identifying message or <code>null</code> for the {@link AssertionError} + * @param object Object to check or <code>null</code> */ static public void assertNotNull(String message, Object object) { assertTrue(message, object != null); } /** - * Asserts that an object isn't null. If it is an AssertionError is + * Asserts that an object isn't null. If it is an {@link AssertionError} is * thrown. + * @param object Object to check or <code>null</code> */ static public void assertNotNull(Object object) { assertNotNull(null, object); } /** - * Asserts that an object is null. If it is not, an AssertionError is + * Asserts that an object is null. If it is not, an {@link AssertionError} is * thrown with the given message. + * @param message the identifying message or <code>null</code> for the {@link AssertionError} + * @param object Object to check or <code>null</code> */ static public void assertNull(String message, Object object) { assertTrue(message, object == null); } /** - * Asserts that an object is null. If it isn't an AssertionError is + * Asserts that an object is null. If it isn't an {@link AssertionError} is * thrown. + * @param object Object to check or <code>null</code> */ static public void assertNull(Object object) { assertNull(null, object); @@ -207,7 +252,10 @@ /** * Asserts that two objects refer to the same object. If they are not, an - * AssertionError is thrown with the given message. + * {@link AssertionError} is thrown with the given message. + * @param message the identifying message or <code>null</code> for the {@link AssertionError} + * @param expected the expected object + * @param actual the object to compare to <code>expected</code> */ static public void assertSame(String message, Object expected, Object actual) { if (expected == actual) @@ -217,7 +265,9 @@ /** * Asserts that two objects refer to the same object. If they are not the - * same, an AssertionError is thrown. + * same, an {@link AssertionError} without a message is thrown. + * @param expected the expected object + * @param actual the object to compare to <code>expected</code> */ static public void assertSame(Object expected, Object actual) { assertSame(null, expected, actual); @@ -225,20 +275,25 @@ /** * Asserts that two objects do not refer to the same object. If they do - * refer to the same object, an AssertionError is thrown with the given + * refer to the same object, an {@link AssertionError} is thrown with the given * message. + * @param message the identifying message or <code>null</code> for the {@link AssertionError} + * @param unexpected the object you don't expect + * @param actual the object to compare to <code>unexpected</code> */ - static public void assertNotSame(String message, Object expected, Object actual) { - if (expected == actual) + static public void assertNotSame(String message, Object unexpected, Object actual) { + if (unexpected == actual) failSame(message); } /** * Asserts that two objects do not refer to the same object. If they do - * refer to the same object, an AssertionError is thrown. + * refer to the same object, an {@link AssertionError} without a message is thrown. + * @param unexpected the object you don't expect + * @param actual the object to compare to <code>unexpected</code> */ - static public void assertNotSame(Object expected, Object actual) { - assertNotSame(null, expected, actual); + static public void assertNotSame(Object unexpected, Object actual) { + assertNotSame(null, unexpected, actual); } static private void failSame(String message) { Index: ComparisonFailure.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/ComparisonFailure.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ComparisonFailure.java 15 Feb 2006 22:55:30 -0000 1.2 +++ ComparisonFailure.java 10 Mar 2006 00:52:15 -0000 1.3 @@ -1,7 +1,7 @@ package org.junit; /** - * Thrown when an assertEquals(String, String) fails. Create and throw + * Thrown when an {@link org.junit.Assert#assertEquals(Object, Object) assertEquals(String, String)} fails. Create and throw * a <code>ComparisonFailure</code> manually if you want to show users the difference between two complex * strings. * @@ -38,14 +38,14 @@ } /** - * Returns the actual value + * Returns the actual string value * @return the actual string value */ public String getActual() { return fActual; } /** - * Returns the expected value + * Returns the expected string value * @return the expected string value */ public String getExpected() { Index: AfterClass.java =================================================================== RCS file: /cvsroot/junit/junit/org/junit/AfterClass.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- AfterClass.java 15 Feb 2006 22:55:30 -0000 1.2 +++ AfterClass.java 10 Mar 2006 00:52:15 -0000 1.3 @@ -6,10 +6,10 @@ import java.lang.annotation.Target; /** - * If you allocate expensive external resources in a <code>@BeforeClass</code> method you need to release them + * If you allocate expensive external resources in a {@link org.junit.BeforeClass} method you need to release them * after all the tests in the class have run. Annotating a <code>public static void</code> method * with <code>@AfterClass</code> causes that method to be run after all the tests in the class have been run. All <code>@AfterClass</code> - * methods are guaranteed to run even if a <code>@BeforeClass</code> method throws an + * methods are guaranteed to run even if a {@link org.junit.BeforeClass} method throws an * exception. The <code>@AfterClass</code> methods declared in superclasses will be run after those of the current * class. * <p> @@ -33,6 +33,7 @@ * </code> * * @see org.junit.BeforeClass + * @see org.junit.Test */ @Retention(RetentionPolicy.RUNTIME) |