diff --git a/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java b/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java index abc5b266f35..bbe8dbfc872 100644 --- a/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java +++ b/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java @@ -333,6 +333,16 @@ public abstract class LuceneTestCase extends TestCase { return LuceneTestCaseJ4.newIndexWriterConfig(r, v, a); } + /** + * Returns a new Dictionary instance. Use this when the test does not + * care about the specific Directory implementation (most tests). + *

+ * The Directory is wrapped with {@link MockDirectoryWrapper}. + * By default this means it will be picky, such as ensuring that you + * properly close it and all open files in your test. It will emulate + * some features of Windows, such as not allowing open files to be + * overwritten. + */ public MockDirectoryWrapper newDirectory(Random r) throws IOException { StackTraceElement[] stack = new Exception().getStackTrace(); Directory impl = LuceneTestCaseJ4.newDirectoryImpl(r, TEST_DIRECTORY); @@ -341,6 +351,11 @@ public abstract class LuceneTestCase extends TestCase { return dir; } + /** + * Returns a new Dictionary instance, with contents copied from the + * provided directory. See {@link #newDirectory(Random)} for more + * information. + */ public MockDirectoryWrapper newDirectory(Random r, Directory d) throws IOException { StackTraceElement[] stack = new Exception().getStackTrace(); Directory impl = LuceneTestCaseJ4.newDirectoryImpl(r, TEST_DIRECTORY); diff --git a/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java b/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java index 04a7728f2ee..76002f9f8d8 100644 --- a/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java +++ b/lucene/src/test/org/apache/lucene/util/LuceneTestCaseJ4.java @@ -591,6 +591,16 @@ public class LuceneTestCaseJ4 { return c; } + /** + * Returns a new Dictionary instance. Use this when the test does not + * care about the specific Directory implementation (most tests). + *

+ * The Directory is wrapped with {@link MockDirectoryWrapper}. + * By default this means it will be picky, such as ensuring that you + * properly close it and all open files in your test. It will emulate + * some features of Windows, such as not allowing open files to be + * overwritten. + */ public static MockDirectoryWrapper newDirectory(Random r) throws IOException { StackTraceElement[] stack = new Exception().getStackTrace(); Directory impl = newDirectoryImpl(r, TEST_DIRECTORY); @@ -599,6 +609,11 @@ public class LuceneTestCaseJ4 { return dir; } + /** + * Returns a new Dictionary instance, with contents copied from the + * provided directory. See {@link #newDirectory(Random)} for more + * information. + */ public static MockDirectoryWrapper newDirectory(Random r, Directory d) throws IOException { StackTraceElement[] stack = new Exception().getStackTrace(); Directory impl = newDirectoryImpl(r, TEST_DIRECTORY);