package org.openntf.domino.tests.general;

import static org.junit.Assert.assertEquals;

import java.util.Vector;

import org.junit.Test;
import org.openntf.domino.Database;
import org.openntf.domino.Document;
import org.openntf.domino.Session;
import org.openntf.domino.tests.AllTests;
import org.openntf.domino.utils.Factory;

public class TestDocuments {
	/**
	 * Tests for https://github.com/OpenNTF/org.openntf.domino/issues/62
	 */
	@Test
	public void testReplaceItemValueMulti() {
		Session session = Factory.getSession();
		Database database = session.getDatabase(AllTests.EMPTY_DB);
		Document doc = database.createDocument();
		Vector<Object> md = new Vector<>();
		md.add(session.createDateTime(2010, 1, 1, 12, 0, 0));
		md.add(session.createDateTime(2010, 2, 1, 12, 0, 0));
		md.add(session.createDateTime(2010, 3, 1, 12, 0, 0));
        doc.replaceItemValue("fldDate2", md);
        assertEquals(md, doc.getItemValue("fldDate2"));
	}
}

@@ -80,16 +80,59 @@
 tEquals;
+%0Aimport static org.junit.Assert.assertTrue;
 %0A%0Aimport
@@ -246,16 +246,62 @@
 cument;%0A
+import org.openntf.domino.DocumentCollection;%0A
 import o
@@ -970,16 +970,16 @@
 %22, md);%0A
-
         
@@ -1029,10 +1029,723 @@
 %22));%0A%09%7D%0A
+%09%0A%09/**%0A%09 * Tests for https://github.com/OpenNTF/org.openntf.domino/issues/55%0A%09 */%0A%09@Test%0A%09public void testDocumentCollectionParent() %7B%0A%09%09Session session = Factory.getSession();%0A%09%09Database database = session.getDatabase(AllTests.EMPTY_DB);%0A%09%09%0A%09%09%7B%0A%09%09%09DocumentCollection docs = database.getAllDocuments();%0A%09%09%09assertTrue(%22docs parent should be a database%22, docs.getParent() instanceof Database);%0A%09%09%7D%0A%09%09%7B%0A%09%09%09Document doc = database.createDocument();%0A%09%09%09doc.save();%0A%09%09%09Document child = database.createDocument();%0A%09%09%09child.makeResponse(doc);%0A%09%09%09child.save();%0A%09%09%09%0A%09%09%09DocumentCollection children = doc.getResponses();%0A%09%09%09assertTrue(%22children parent should be a database%22, children.getParent() instanceof Database);%0A%09%09%7D%0A%09%7D%0A
 %7D%0A

Add test for GitHub issue #55