Index: TestDocument.java =================================================================== RCS file: /home/cvspublic/jakarta-lucene/src/test/org/apache/lucene/document/TestDocument.java,v retrieving revision 1.3 diff -u -r1.3 TestDocument.java --- TestDocument.java 29 Mar 2004 22:48:06 -0000 1.3 +++ TestDocument.java 18 Apr 2004 16:22:53 -0000 @@ -40,6 +40,29 @@ */ public class TestDocument extends TestCase { + + /** + * Tests {@link Document#remove()} method for a brand new Document + * that has not been indexed yet. + * + * @throws Exception on error + */ + public void testRemoveForNewDocument() throws Exception + { + Document doc = makeDocumentWithFields(); + assertEquals(8, doc.fields.size()); + doc.remove("keyword"); + assertEquals(6, doc.fields.size()); + doc.remove("keyword"); // removing a field more than once + assertEquals(6, doc.fields.size()); + doc.remove("text"); + doc.remove("unindexed"); + doc.remove("unstored"); + assertEquals(0, doc.fields.size()); + doc.remove("doesnotexists"); // removing non-existing fields is siltenlty ignored + assertEquals(0, doc.fields.size()); + } + /** * Tests {@link Document#getValues()} method for a brand new Document * that has not been indexed yet.