|
210 | 210 | import org.junit.BeforeClass; |
211 | 211 | import org.junit.ClassRule; |
212 | 212 | import org.junit.Rule; |
213 | | -import org.junit.Test; |
214 | 213 | import org.junit.internal.AssumptionViolatedException; |
215 | 214 | import org.junit.rules.RuleChain; |
216 | 215 | import org.junit.rules.TestRule; |
217 | 216 | import org.junit.runner.RunWith; |
218 | 217 |
|
219 | | -/** |
220 | | - * Base class for all Lucene unit tests, Junit3 or Junit4 variant. |
221 | | - * |
222 | | - * <h2>Class and instance setup.</h2> |
223 | | - * |
224 | | - * <p>The preferred way to specify class (suite-level) setup/cleanup is to use static methods |
225 | | - * annotated with {@link BeforeClass} and {@link AfterClass}. Any code in these methods is executed |
226 | | - * within the test framework's control and ensure proper setup has been made. <b>Try not to use |
227 | | - * static initializers (including complex final field initializers).</b> Static initializers are |
228 | | - * executed before any setup rules are fired and may cause you (or somebody else) headaches. |
229 | | - * |
230 | | - * <p>For instance-level setup, use {@link Before} and {@link After} annotated methods. If you |
231 | | - * override either {@link #setUp()} or {@link #tearDown()} in your subclass, make sure you call |
232 | | - * <code>super.setUp()</code> and <code>super.tearDown()</code>. This is detected and enforced. |
233 | | - * |
234 | | - * <h2>Specifying test cases</h2> |
235 | | - * |
236 | | - * <p>Any test method with a <code>testXXX</code> prefix is considered a test case. Any test method |
237 | | - * annotated with {@link Test} is considered a test case. |
238 | | - * |
239 | | - * <h2>Randomized execution and test facilities</h2> |
240 | | - * |
241 | | - * <p>{@link LuceneTestCase} uses {@link RandomizedRunner} to execute test cases. {@link |
242 | | - * RandomizedRunner} has built-in support for tests randomization including access to a repeatable |
243 | | - * {@link Random} instance. See {@link #random()} method. Any test using {@link Random} acquired |
244 | | - * from {@link #random()} should be fully reproducible (assuming no race conditions between threads |
245 | | - * etc.). The initial seed for a test case is reported in many ways: |
246 | | - * |
247 | | - * <ul> |
248 | | - * <li>as part of any exception thrown from its body (inserted as a dummy stack trace entry), |
249 | | - * <li>as part of the main thread executing the test case (if your test hangs, just dump the stack |
250 | | - * trace of all threads and you'll see the seed), |
251 | | - * <li>the master seed can also be accessed manually by getting the current context ({@link |
252 | | - * RandomizedContext#current()}) and then calling {@link |
253 | | - * RandomizedContext#getRunnerSeedAsString()}. |
254 | | - * </ul> |
255 | | - */ |
| 218 | +/// Base class for all Lucene unit tests (JUnit4 variant). |
| 219 | +/// |
| 220 | +/// ## Class and instance setup |
| 221 | +/// |
| 222 | +/// The preferred way to specify class (suite-level) setup/cleanup is to use static methods |
| 223 | +/// annotated with [BeforeClass] and [AfterClass]. Any code in these methods is executed |
| 224 | +/// within the test framework's control and ensure proper setup has been made. **Try not to use |
| 225 | +/// static initializers (including complex final field initializers).** Static initializers are |
| 226 | +/// executed before any setup rules are fired and may cause you (or somebody else) headaches. |
| 227 | +/// |
| 228 | +/// For instance-level setup, use [Before] and [After] annotated methods. If you |
| 229 | +/// override either [#setUp()] or [#tearDown()] in your subclass, make sure you call |
| 230 | +/// `super.setUp()` and `super.tearDown()`. This is detected and enforced. |
| 231 | +/// |
| 232 | +/// ## Specifying test cases |
| 233 | +/// |
| 234 | +/// Any test method with a `testXXX` prefix is considered a test case. Any test method |
| 235 | +/// annotated with [org.junit.Test] is considered a test case. For example, these are equivalent |
| 236 | +/// declarations: |
| 237 | +/// |
| 238 | +/// ```java |
| 239 | +/// public void testPrefixIsSufficient() {} |
| 240 | +/// |
| 241 | +/// @Test |
| 242 | +/// public void annotationIsRequiredHere() {} |
| 243 | +/// ``` |
| 244 | +/// |
| 245 | +/// ## Randomized execution and test facilities |
| 246 | +/// |
| 247 | +/// [LuceneTestCase] uses [RandomizedRunner] to execute test cases. |
| 248 | +/// [RandomizedRunner] has built-in support for tests randomization including access to a repeatable |
| 249 | +/// [Random] instance. See [#random()] method. Any test using [Random] acquired |
| 250 | +/// from [#random()] should be fully reproducible (assuming no race conditions between threads |
| 251 | +/// etc.). The initial seed for a test case is reported in many ways: |
| 252 | +/// |
| 253 | +/// - as part of any exception thrown from its body (inserted as a dummy stack trace entry), |
| 254 | +/// - as part of the main thread executing the test case (if your test hangs, just dump the stack |
| 255 | +/// trace of all threads, and you'll see the seed), |
| 256 | +/// - the master seed can also be accessed manually by getting the current context ( |
| 257 | +/// [RandomizedContext#current()]) and then calling |
| 258 | +/// [RandomizedContext#getRunnerSeedAsString()]. |
| 259 | +/// |
256 | 260 | @RunWith(RandomizedRunner.class) |
257 | 261 | @TestMethodProviders({LuceneJUnit3MethodProvider.class, JUnit4MethodProvider.class}) |
258 | 262 | @Listeners({RunListenerPrintReproduceInfo.class, FailureMarker.class}) |
|
0 commit comments