Skip to content

Commit e012e06

Browse files
author
David Saff
committed
Merge pull request junit-team#648 from dlam/master
Fix inconsistencies in javadocs.
2 parents 72af03c + bf98573 commit e012e06

File tree

18 files changed

+88
-117
lines changed

18 files changed

+88
-117
lines changed

src/main/java/junit/framework/TestSuite.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,30 @@
1414
import org.junit.internal.MethodSorter;
1515

1616
/**
17-
* <p>A <code>TestSuite</code> is a <code>Composite</code> of Tests.
17+
* A <code>TestSuite</code> is a <code>Composite</code> of Tests.
1818
* It runs a collection of test cases. Here is an example using
1919
* the dynamic test definition.
2020
* <pre>
2121
* TestSuite suite= new TestSuite();
2222
* suite.addTest(new MathTest("testAdd"));
2323
* suite.addTest(new MathTest("testDivideByZero"));
2424
* </pre>
25-
* </p>
26-
*
27-
* <p>Alternatively, a TestSuite can extract the tests to be run automatically.
25+
* <p>
26+
* Alternatively, a TestSuite can extract the tests to be run automatically.
2827
* To do so you pass the class of your TestCase class to the
2928
* TestSuite constructor.
3029
* <pre>
3130
* TestSuite suite= new TestSuite(MathTest.class);
3231
* </pre>
33-
* </p>
34-
*
35-
* <p>This constructor creates a suite with all the methods
36-
* starting with "test" that take no arguments.</p>
37-
*
38-
* <p>A final option is to do the same for a large array of test classes.
32+
* <p>
33+
* This constructor creates a suite with all the methods
34+
* starting with "test" that take no arguments.
35+
* <p>
36+
* A final option is to do the same for a large array of test classes.
3937
* <pre>
4038
* Class[] testClasses = { MathTest.class, AnotherTest.class }
4139
* TestSuite suite= new TestSuite(testClasses);
4240
* </pre>
43-
* </p>
4441
*
4542
* @see Test
4643
*/

src/main/java/junit/textui/TestRunner.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
* <pre>
1616
* java junit.textui.TestRunner [-wait] TestCaseClass
1717
* </pre>
18-
*
19-
* <p>TestRunner expects the name of a TestCase class as argument.
18+
* <p>
19+
* TestRunner expects the name of a TestCase class as argument.
2020
* If this class defines a static <code>suite</code> method it
2121
* will be invoked and the returned test is run. Otherwise all
22-
* the methods starting with "test" having no arguments are run.</p>
23-
*
24-
* <p> When the wait command line argument is given TestRunner
25-
* waits until the users types RETURN.</p>
26-
*
27-
* <p>TestRunner prints a trace as the tests are executed followed by a
28-
* summary at the end.</p>
22+
* the methods starting with "test" having no arguments are run.
23+
* <p>
24+
* When the wait command line argument is given TestRunner
25+
* waits until the users types RETURN.
26+
* <p>
27+
* TestRunner prints a trace as the tests are executed followed by a
28+
* summary at the end.
2929
*/
3030
public class TestRunner extends BaseTestRunner {
3131
private ResultPrinter fPrinter;

src/main/java/org/junit/After.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
import java.lang.annotation.Target;
77

88
/**
9-
* <p>If you allocate external resources in a {@link org.junit.Before} method you need to release them
9+
* If you allocate external resources in a {@link org.junit.Before} method you need to release them
1010
* after the test runs. Annotating a <code>public void</code> method
1111
* with <code>&#064;After</code> causes that method to be run after the {@link org.junit.Test} method. All <code>&#064;After</code>
1212
* methods are guaranteed to run even if a {@link org.junit.Before} or {@link org.junit.Test} method throws an
1313
* exception. The <code>&#064;After</code> methods declared in superclasses will be run after those of the current
14-
* class, unless they are overridden in the current class.</p>
15-
*
14+
* class, unless they are overridden in the current class.
15+
* <p>
1616
* Here is a simple example:
1717
* <pre>
1818
* public class Example {

src/main/java/org/junit/AfterClass.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
import java.lang.annotation.Target;
77

88
/**
9-
* <p>If you allocate expensive external resources in a {@link org.junit.BeforeClass} method you need to release them
9+
* If you allocate expensive external resources in a {@link org.junit.BeforeClass} method you need to release them
1010
* after all the tests in the class have run. Annotating a <code>public static void</code> method
1111
* with <code>&#064;AfterClass</code> causes that method to be run after all the tests in the class have been run. All <code>&#064;AfterClass</code>
1212
* methods are guaranteed to run even if a {@link org.junit.BeforeClass} method throws an
1313
* exception. The <code>&#064;AfterClass</code> methods declared in superclasses will be run after those of the current
14-
* class, unless they are shadowed in the current class.</p>
15-
*
14+
* class, unless they are shadowed in the current class.
15+
* <p>
1616
* Here is a simple example:
1717
* <pre>
1818
* public class Example {

src/main/java/org/junit/Before.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
import java.lang.annotation.Target;
77

88
/**
9-
* <p>When writing tests, it is common to find that several tests need similar
9+
* When writing tests, it is common to find that several tests need similar
1010
* objects created before they can run. Annotating a <code>public void</code> method
1111
* with <code>&#064;Before</code> causes that method to be run before the {@link org.junit.Test} method.
1212
* The <code>&#064;Before</code> methods of superclasses will be run before those of the current class,
1313
* unless they are overridden in the current class. No other ordering is defined.
14-
* </p>
15-
*
14+
* <p>
1615
* Here is a simple example:
1716
* <pre>
1817
* public class Example {

src/main/java/org/junit/BeforeClass.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
import java.lang.annotation.Target;
77

88
/**
9-
* <p>Sometimes several tests need to share computationally expensive setup
9+
* Sometimes several tests need to share computationally expensive setup
1010
* (like logging into a database). While this can compromise the independence of
1111
* tests, sometimes it is a necessary optimization. Annotating a <code>public static void</code> no-arg method
1212
* with <code>@BeforeClass</code> causes it to be run once before any of
1313
* the test methods in the class. The <code>@BeforeClass</code> methods of superclasses
14-
* will be run before those the current class, unless they are shadowed in the current class.</p>
15-
*
14+
* will be run before those the current class, unless they are shadowed in the current class.
15+
* <p>
1616
* For example:
1717
* <pre>
1818
* public class Example {

src/main/java/org/junit/ClassRule.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,30 @@
88
/**
99
* Annotates static fields that reference rules or methods that return them. A field must be public,
1010
* static, and a subtype of {@link org.junit.rules.TestRule}. A method must be public static, and return
11-
* a subtype of {@link org.junit.rules.TestRule}.<p>
12-
*
11+
* a subtype of {@link org.junit.rules.TestRule}.
12+
* <p>
1313
* The {@link org.junit.runners.model.Statement} passed
1414
* to the {@link org.junit.rules.TestRule} will run any {@link BeforeClass} methods,
1515
* then the entire body of the test class (all contained methods, if it is
1616
* a standard JUnit test class, or all contained classes, if it is a
1717
* {@link org.junit.runners.Suite}), and finally any {@link AfterClass} methods.
18-
*
18+
* <p>
1919
* The statement passed to the {@link org.junit.rules.TestRule} will never throw an exception,
2020
* and throwing an exception from the {@link org.junit.rules.TestRule} will result in undefined
2121
* behavior. This means that some {@link org.junit.rules.TestRule}s, such as
2222
* {@link org.junit.rules.ErrorCollector},
2323
* {@link org.junit.rules.ExpectedException},
2424
* and {@link org.junit.rules.Timeout},
2525
* have undefined behavior when used as {@link ClassRule}s.
26-
*
26+
* <p>
2727
* If there are multiple
2828
* annotated {@link ClassRule}s on a class, they will be applied in an order
2929
* that depends on your JVM's implementation of the reflection API, which is
3030
* undefined, in general. However, Rules defined by fields will always be applied
3131
* before Rules defined by methods.
32-
*
32+
* <p>
3333
* For example, here is a test suite that connects to a server once before
3434
* all the test classes run, and disconnects after they are finished:
35-
*
3635
* <pre>
3736
* &#064;RunWith(Suite.class)
3837
* &#064;SuiteClasses({A.class, B.class, C.class})
@@ -53,9 +52,8 @@
5352
* };
5453
* }
5554
* </pre>
56-
*
55+
* <p>
5756
* and the same using a method
58-
*
5957
* <pre>
6058
* &#064;RunWith(Suite.class)
6159
* &#064;SuiteClasses({A.class, B.class, C.class})
@@ -78,7 +76,7 @@
7876
* }
7977
* }
8078
* </pre>
81-
*
79+
* <p>
8280
* For more information and more examples, see {@link org.junit.rules.TestRule}.
8381
*
8482
* @since 4.9

src/main/java/org/junit/Ignore.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
import java.lang.annotation.Target;
77

88
/**
9-
* <p>Sometimes you want to temporarily disable a test or a group of tests. Methods annotated with
9+
* Sometimes you want to temporarily disable a test or a group of tests. Methods annotated with
1010
* {@link org.junit.Test} that are also annotated with <code>&#064;Ignore</code> will not be executed as tests.
1111
* Also, you can annotate a class containing test methods with <code>&#064;Ignore</code> and none of the containing
1212
* tests will be executed. Native JUnit 4 test runners should report the number of ignored tests along with the
13-
* number of tests that ran and the number of tests that failed.</p>
14-
*
13+
* number of tests that ran and the number of tests that failed.
14+
* <p>
1515
* For example:
1616
* <pre>
1717
* &#064;Ignore &#064;Test public void something() { ...

src/main/java/org/junit/Rule.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
* static, and a subtype of {@link org.junit.rules.TestRule} (preferred) or
1111
* {@link org.junit.rules.MethodRule}. A method must be public, not static,
1212
* and must return a subtype of {@link org.junit.rules.TestRule} (preferred) or
13-
* {@link org.junit.rules.MethodRule}.<p>
14-
*
13+
* {@link org.junit.rules.MethodRule}.
14+
* <p>
1515
* The {@link org.junit.runners.model.Statement} passed
1616
* to the {@link org.junit.rules.TestRule} will run any {@link Before} methods,
1717
* then the {@link Test} method, and finally any {@link After} methods,
@@ -20,11 +20,10 @@
2020
* However, if there are mutliple fields (or methods) they will be applied in an order
2121
* that depends on your JVM's implementation of the reflection API, which is
2222
* undefined, in general. Rules defined by fields will always be applied
23-
* before Rules defined by methods.<p>
24-
*
23+
* before Rules defined by methods.
24+
* <p>
2525
* For example, here is a test class that creates a temporary folder before
2626
* each test method, and deletes it after each:
27-
*
2827
* <pre>
2928
* public static class HasTempFolder {
3029
* &#064;Rule
@@ -38,9 +37,8 @@
3837
* }
3938
* }
4039
* </pre>
41-
*
40+
* <p>
4241
* And the same using a method.
43-
*
4442
* <pre>
4543
* public static class HasTempFolder {
4644
* private TemporaryFolder folder= new TemporaryFolder();
@@ -58,7 +56,7 @@
5856
* }
5957
* }
6058
* </pre>
61-
*
59+
* <p>
6260
* For more information and more examples, see
6361
* {@link org.junit.rules.TestRule}.
6462
*

src/main/java/org/junit/Test.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
import java.lang.annotation.Target;
77

88
/**
9-
* <p>The <code>Test</code> annotation tells JUnit that the <code>public void</code> method
9+
* The <code>Test</code> annotation tells JUnit that the <code>public void</code> method
1010
* to which it is attached can be run as a test case. To run the method,
1111
* JUnit first constructs a fresh instance of the class then invokes the
1212
* annotated method. Any exceptions thrown by the test will be reported
1313
* by JUnit as a failure. If no exceptions are thrown, the test is assumed
14-
* to have succeeded.</p>
15-
*
16-
* <p>A simple test looks like this:
14+
* to have succeeded.
15+
* <p>
16+
* A simple test looks like this:
1717
* <pre>
1818
* public class Example {
1919
* <b>&#064;Test</b>
@@ -22,9 +22,8 @@
2222
* }
2323
* }
2424
* </pre>
25-
* </p>
26-
*
27-
* <p>The <code>Test</code> annotation supports two optional parameters.
25+
* <p>
26+
* The <code>Test</code> annotation supports two optional parameters.
2827
* The first, <code>expected</code>, declares that a test method should throw
2928
* an exception. If it doesn't throw an exception or if it throws a different exception
3029
* than the one declared, the test fails. For example, the following test succeeds:
@@ -33,14 +32,14 @@
3332
* new ArrayList&lt;Object&gt;().get(1);
3433
* }
3534
* </pre></p>
36-
*
37-
* <p>The second optional parameter, <code>timeout</code>, causes a test to fail if it takes
35+
* <p>
36+
* The second optional parameter, <code>timeout</code>, causes a test to fail if it takes
3837
* longer than a specified amount of clock time (measured in milliseconds). The following test fails:
3938
* <pre>
4039
* &#064;Test(<b>timeout=100</b>) public void infinity() {
4140
* while(true);
4241
* }
43-
* </pre></p>
42+
* </pre>
4443
*
4544
* @since 4.0
4645
*/

0 commit comments

Comments
 (0)