// Path: org.abego.treelayout/src/main/java/org/abego/treelayout/util/DefaultTreeForTreeLayout.java
// public class DefaultTreeForTreeLayout<TreeNode> extends
// 		AbstractTreeForTreeLayout<TreeNode> {
// 
// 	private List<TreeNode> emptyList;
// 
// 	private List<TreeNode> getEmptyList() {
// 		if (emptyList == null) {
// 			emptyList = new ArrayList<TreeNode>();
// 		}
// 		return emptyList;
// 	}
// 
// 	private Map<TreeNode, List<TreeNode>> childrenMap = new HashMap<TreeNode, List<TreeNode>>();
// 	private Map<TreeNode, TreeNode> parents = new HashMap<TreeNode, TreeNode>();
// 
// 	/**
// 	 * Creates a new instance with a given node as the root
// 	 * 
// 	 * @param root
// 	 *            the node to be used as the root.
// 	 */
// 	public DefaultTreeForTreeLayout(TreeNode root) {
// 		super(root);
// 	}
// 
// 	@Override
// 	public TreeNode getParent(TreeNode node) {
// 		return parents.get(node);
// 	}
// 
// 	@Override
// 	public List<TreeNode> getChildrenList(TreeNode node) {
// 		List<TreeNode> result = childrenMap.get(node);
// 		return result == null ? getEmptyList() : result;
// 	}
// 
// 	/**
// 	 * 
// 	 * @param node &nbsp;
// 	 * @return true iff the node is in the tree
// 	 */
// 	public boolean hasNode(TreeNode node) {
// 		return node == getRoot() || parents.containsKey(node);
// 	}
// 
// 	/**
// 	 * @param parentNode
// 	 *            [hasNode(parentNode)]
// 	 * @param node
// 	 *            [!hasNode(node)]
// 	 */
// 	public void addChild(TreeNode parentNode, TreeNode node) {
// 		checkArg(hasNode(parentNode), "parentNode is not in the tree");
// 		checkArg(!hasNode(node), "node is already in the tree");
// 
// 		List<TreeNode> list = childrenMap.get(parentNode);
// 		if (list == null) {
// 			list = new ArrayList<TreeNode>();
// 			childrenMap.put(parentNode, list);
// 		}
// 		list.add(node);
// 		parents.put(node, parentNode);
// 	}
// 
// 	public void addChildren(TreeNode parentNode, TreeNode... nodes) {
// 		for (TreeNode node : nodes) {
// 			addChild(parentNode, node);
// 		}
// 	}
// 
// }


import java.util.List;
import org.abego.treelayout.util.DefaultTreeForTreeLayout;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.Iterator;
		tree.addChildren("N1", "N1.1");

		assertEquals("N1", tree.getChildrenList("ROOT").get(0));
		assertEquals("N1.1", tree.getChildrenList("N1").get(0));
		assertEquals("N2", tree.getChildrenList("ROOT").get(1));
	}

	@Test
	public void testAddChild_alreadyInTree() throws Exception {
		DefaultTreeForTreeLayout<String> tree = new DefaultTreeForTreeLayout<String>(
				"ROOT");

		try {
			tree.addChild("ROOT", "ROOT");
			fail("exception expected");
		} catch (Exception ex) {
			assertEquals("node is already in the tree", ex.getMessage());
		}

		tree.addChild("ROOT", "N1");
		try {
			tree.addChild("ROOT", "N1");
			fail("exception expected");
		} catch (Exception ex) {
			assertEquals("node is already in the tree", ex.getMessage());
		}
	}
	
	@Test
	public void testAddChild_parentNotInTree() throws Exception {
// Path: org.abego.treelayout/src/main/java/org/abego/treelayout/util/DefaultTreeForTreeLayout.java
// public class DefaultTreeForTreeLayout<TreeNode> extends
// 		AbstractTreeForTreeLayout<TreeNode> {
// 
// 	private List<TreeNode> emptyList;
// 
// 	private List<TreeNode> getEmptyList() {
// 		if (emptyList == null) {
// 			emptyList = new ArrayList<TreeNode>();
// 		}
// 		return emptyList;
// 	}
// 
// 	private Map<TreeNode, List<TreeNode>> childrenMap = new HashMap<TreeNode, List<TreeNode>>();
// 	private Map<TreeNode, TreeNode> parents = new HashMap<TreeNode, TreeNode>();
// 
// 	/**
// 	 * Creates a new instance with a given node as the root
// 	 * 
// 	 * @param root
// 	 *            the node to be used as the root.
// 	 */
// 	public DefaultTreeForTreeLayout(TreeNode root) {
// 		super(root);
// 	}
// 
// 	@Override
// 	public TreeNode getParent(TreeNode node) {
// 		return parents.get(node);
// 	}
// 
// 	@Override
// 	public List<TreeNode> getChildrenList(TreeNode node) {
// 		List<TreeNode> result = childrenMap.get(node);
// 		return result == null ? getEmptyList() : result;
// 	}
// 
// 	/**
// 	 * 
// 	 * @param node &nbsp;
// 	 * @return true iff the node is in the tree
// 	 */
// 	public boolean hasNode(TreeNode node) {
// 		return node == getRoot() || parents.containsKey(node);
// 	}
// 
// 	/**
// 	 * @param parentNode
// 	 *            [hasNode(parentNode)]
// 	 * @param node
// 	 *            [!hasNode(node)]
// 	 */
// 	public void addChild(TreeNode parentNode, TreeNode node) {
// 		checkArg(hasNode(parentNode), "parentNode is not in the tree");
// 		checkArg(!hasNode(node), "node is already in the tree");
// 
// 		List<TreeNode> list = childrenMap.get(parentNode);
// 		if (list == null) {
// 			list = new ArrayList<TreeNode>();
// 			childrenMap.put(parentNode, list);
// 		}
// 		list.add(node);
// 		parents.put(node, parentNode);
// 	}
// 
// 	public void addChildren(TreeNode parentNode, TreeNode... nodes) {
// 		for (TreeNode node : nodes) {
// 			addChild(parentNode, node);
// 		}
// 	}
// 
// }


// Path: org.abego.treelayout/src/test/java/org/abego/treelayout/util/DefaultTreeForTreeLayoutTest.java
import java.util.List;
import org.abego.treelayout.util.DefaultTreeForTreeLayout;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import java.util.Iterator;

		tree.addChildren("N1", "N1.1");

		assertEquals("N1", tree.getChildrenList("ROOT").get(0));
		assertEquals("N1.1", tree.getChildrenList("N1").get(0));
		assertEquals("N2", tree.getChildrenList("ROOT").get(1));
	}

	@Test
	public void testAddChild_alreadyInTree() throws Exception {
		DefaultTreeForTreeLayout<String> tree = new DefaultTreeForTreeLayout<String>(
				"ROOT");

		try {
			tree.addChild("ROOT", "ROOT");
			fail("exception expected");
		} catch (Exception ex) {
			assertEquals("node is already in the tree", ex.getMessage());
		}

		tree.addChild("ROOT", "N1");
		try {
			tree.addChild("ROOT", "N1");
			fail("exception expected");
		} catch (Exception ex) {
			assertEquals("node is already in the tree", ex.getMessage());
		}
	}
	
	@Test
	public void testAddChild_parentNotInTree() throws Exception {
		DefaultTreeForTreeLayout<String> tree = new DefaultTreeForTreeLayout<String>(