<commit_before>/*
 * This file is part of COMPASS. It is subject to the license terms in
 * the LICENSE file found in the top-level directory of this distribution.
 * (Also available at http://www.apache.org/licenses/LICENSE-2.0.txt)
 * You may not use this file except in compliance with the License.
 */
package de.dfki.asr.compass.model;

import org.testng.annotations.Test;
import static org.testng.Assert.*;

@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public class PrefabSetTest {

	@Test
	public void checkSetParentOfChild()	{
		PrefabSet originalPrefab = new PrefabSet("original");
		PrefabSet newParent = new PrefabSet("newParent");
		PrefabSet oldParent = new PrefabSet("oldParent");
		originalPrefab.setParent(oldParent);
		originalPrefab.setParent(newParent);

		assertEquals(originalPrefab.getParent(), newParent);
		assertNotEquals(originalPrefab.getParent(), oldParent);
		assertTrue(originalPrefab.isChildOf(newParent));
	}

	@Test
	public void setParentRemovesOldChild() {
		PrefabSet originalPrefab = new PrefabSet("original");
		PrefabSet newParent = new PrefabSet("newParent");
		PrefabSet oldParent = new PrefabSet("oldParent");
		originalPrefab.setParent(oldParent);
		originalPrefab.setParent(newParent);

		assertFalse(originalPrefab.isChildOf(oldParent));

	}
	@Test
	public void checkSetParent() {
		PrefabSet originalPrefab = new PrefabSet("original");
		PrefabSet newParent = new PrefabSet("newParent");

		originalPrefab.setParent(newParent);
		assertEquals(originalPrefab.getParent(),newParent);
		assertTrue(originalPrefab.isChildOf(newParent));
	}

	@Test
	public void checkSetSameParent() {
		PrefabSet originalPrefab = new PrefabSet("original");
		PrefabSet newParent = new PrefabSet("newParent");

		originalPrefab.setParent(newParent);
		assertEquals(originalPrefab.getParent(),newParent);
		assertTrue(originalPrefab.isChildOf(newParent));
	}

}<commit_msg>Some renaming in prefabSet tests, split tests for setting parent and appending as child<commit_after>/*
 * This file is part of COMPASS. It is subject to the license terms in
 * the LICENSE file found in the top-level directory of this distribution.
 * (Also available at http://www.apache.org/licenses/LICENSE-2.0.txt)
 * You may not use this file except in compliance with the License.
 */
package de.dfki.asr.compass.model;

import org.testng.annotations.Test;
import static org.testng.Assert.*;

@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public class PrefabSetTest {

	@Test
	public void prefabSetSetParentShouldSetParent() {
		PrefabSet childPrefab = new PrefabSet("original");
		PrefabSet newParent = new PrefabSet("newParent");

		childPrefab.setParent(newParent);
		assertEquals(childPrefab.getParent(),newParent);
	}

	@Test
	public void prefabSetSetParentShouldReparent()	{
		PrefabSet childPrefab = new PrefabSet("original");
		PrefabSet newParent = new PrefabSet("newParent");
		PrefabSet oldParent = new PrefabSet("oldParent");
		childPrefab.setParent(oldParent);
		childPrefab.setParent(newParent);

		assertEquals(childPrefab.getParent(), newParent);
		assertNotEquals(childPrefab.getParent(), oldParent);
	}

	@Test
	public void prefabSetSetParentShouldAppendNewChild() {
		PrefabSet childPrefab = new PrefabSet("original");
		PrefabSet newParent = new PrefabSet("newParent");
		PrefabSet oldParent = new PrefabSet("oldParent");
		childPrefab.setParent(oldParent);
		childPrefab.setParent(newParent);

		assertTrue(childPrefab.isChildOf(newParent));

	}
	@Test
	public void prefabSetSetParentShouldRemoveOldChild() {
		PrefabSet childPrefab = new PrefabSet("original");
		PrefabSet newParent = new PrefabSet("newParent");
		PrefabSet oldParent = new PrefabSet("oldParent");
		childPrefab.setParent(oldParent);
		childPrefab.setParent(newParent);

		assertFalse(childPrefab.isChildOf(oldParent));

	}
	@Test
	public void prefabSetSetSameParentShouldDoNothing() {
		PrefabSet childPrefab = new PrefabSet("original");
		PrefabSet newParent = new PrefabSet("newParent");

		childPrefab.setParent(newParent);
		PrefabSet beforeSet = childPrefab;
		childPrefab.setParent(newParent);
		assertEquals(childPrefab,beforeSet);
	}

}
{'fraction_non_alphanumeric': 0.10456411494808017, 'fraction_numerical': 0.0009659502535619416, 'mean_word_length': 6.08034188034188, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4334478', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1201, 'n_words': 283}