/*******************************************************************************
 * Copyright 2016 Friedrich-Schiller-Universität Jena
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Contributors:
 *     Stephan Druskat - initial API and implementation
 *******************************************************************************/
package org.corpus_tools.atomic.projects;

 import static org.junit.Assert.*;

import org.apache.commons.lang3.tuple.MutablePair;
import org.junit.Before;
import org.junit.Test;

import com.codebox.bean.JavaBeanTester;

/**
 * Unit test for {@link Document}.
 *
 * <p>@author Stephan Druskat <stephan.druskat@uni-jena.de>
 *
 */
public class DocumentTest {
	
	private Document fixture = null;

	/**
	 * Set the fixture.
	 *
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		Document d = new Document();
		d.setName("document");
		d.setSourceText("text");
		setFixture(d);
	}

	/**
	 * Test method for {@link org.corpus_tools.atomic.projects.Document#Document(java.lang.String, java.lang.String)}.
	 */
	@Test
	public void testDocument() {
		assertNotNull(getFixture());
		assertEquals(new MutablePair<String, String>("document", "text"), getFixture());
		assertNull(getFixture().getChildren());
	}

	/**
	 * Test method for {@link org.corpus_tools.atomic.projects.Document#getName()}.
	 */
	@Test
	public void testGetName() {
		assertEquals("document", getFixture().getName());
		getFixture().setName("dokument");
		assertEquals("dokument", getFixture().getName());
	}

	/**
	 * Test method for {@link org.corpus_tools.atomic.projects.Document#getChildren()}.
	 */
	@Test
	public void testGetChildren() {
		assertNull(getFixture().getChildren());
	}

	/**
	 * Test method for {@link org.corpus_tools.atomic.projects.Document#addChild(org.corpus_tools.atomic.projects.ProjectNode)}.
	 */
	@Test
	public void testAddChild() {
		assertNull(getFixture().addChild(new Corpus()));
		assertNull(getFixture().addChild(new Document()));
	}

	/**
	 * Test method for {@link org.corpus_tools.atomic.projects.Document#removeChild(java.lang.String)}.
	 */
	@Test
	public void testRemoveChild() {
		assertNull(getFixture().removeChild("x"));
	}

	/**
	 * Test method for {@link org.corpus_tools.atomic.projects.Document#getSourceText()}.
	 */
	@Test
	public void testGetSourceText() {
		assertEquals("text", getFixture().getSourceText());
	}

	@Test
	public void testBeanFeatures() {
		Document d = new Document();
		d.setName("document");
		d.setSourceText("text");
		JavaBeanTester.builder(Document.class).loadData().testInstance(getFixture());
		JavaBeanTester.builder(Document.class).loadData().testEquals(getFixture(), d);
	}

	/**
	 * @return the fixture
	 */
	private Document getFixture() {
		return fixture;
	}

	/**
	 * @param fixture the fixture to set
	 */
	private void setFixture(Document fixture) {
		this.fixture = fixture;
	}

}

@@ -1658,71 +1658,173 @@
 ;%0A%09%09
-assertEquals(new MutablePair%3CString, String%3E(%22document%22, %22text%22
+Document d = new Document();%0A%09%09d.setName(%22document%22);%0A%09%09d.setSourceText(%22text%22);%0A%09%09assertEquals(d.getName(), getFixture().getName());%0A%09%09assertEquals(d.getSourceText(
 ), g
@@ -1830,24 +1830,40 @@
 getFixture()
+.getSourceText()
 );%0A%09%09assertN

Refactor test method that still worked on MutablePair-based impl