/**
* This tests getNodeAtPath. We want to make sure it locates nodes via path from several locations.
*/
public void testGetNodeAtPath() {
//add some sample nodes. I'm indenting these to better show the structure I'm making
SettingsNode childNode1 = rootNode.addChild(SAMPLE_NAME_1);
SettingsNode grandChildNodeA1 = childNode1.addChild("sub_nodeA1");
SettingsNode greatGrandChildNodeA11 = grandChildNodeA1.addChild("sub_sub_nodeA11");
SettingsNode greatGrandChildNodeA12 = grandChildNodeA1.addChild("sub_sub_nodeA12");
SettingsNode grandChildNodeA2 = childNode1.addChild("sub_nodeA2");
SettingsNode greatGrandChildNodeA21 = grandChildNodeA2.addChild("sub_sub_nodeA21");
SettingsNode greatGrandChildNodeA22 = grandChildNodeA2.addChild("sub_sub_nodeA22");
SettingsNode childNode2 = rootNode.addChild(SAMPLE_NAME_2);
SettingsNode grandChildNodeB1 = childNode2.addChild("sub_nodeB1");
SettingsNode greatGrandChildNodeB11 = grandChildNodeB1.addChild("sub_sub_nodeB11");
SettingsNode greatGrandChildNodeB12 = grandChildNodeB1.addChild("sub_sub_nodeB12");
SettingsNode grandChildNodeB2 = childNode2.addChild("sub_nodeB2");
SettingsNode childNode3 = rootNode.addChild(SAMPLE_NAME_3);
//now start searching for some nodes
SettingsNode foundNode1 = rootNode.getNodeAtPath(SAMPLE_NAME_1, "sub_nodeA2", "sub_sub_nodeA22");
assertEquals(greatGrandChildNodeA22, foundNode1);
//try searching from something other than the root. It's still relative to the starting node.
SettingsNode foundNode2 = childNode2.getNodeAtPath("sub_nodeB1", "sub_sub_nodeB11");
assertEquals(greatGrandChildNodeB11, foundNode2);
//try searching for something that doesn't exist at the first level of the sought path.
SettingsNode foundNode3 = rootNode.getNodeAtPath("nonexistent", "sub_nodeA2", "sub_sub_nodeA22");
assertNull(foundNode3);
//try searching for something that doesn't exist at the second level of the sought path
SettingsNode foundNode4 = rootNode.getNodeAtPath(SAMPLE_NAME_3, "sub_nodeA2", "sub_sub_nodeA22");
assertNull(foundNode4);
//try searching for something that doesn't exist at the last level of the sought path
SettingsNode foundNode5 = rootNode.getNodeAtPath(SAMPLE_NAME_2, "sub_nodeB2", "sub_sub_nodeB22");
assertNull(foundNode5);
//try searching for a node using a single path
SettingsNode foundNode6 = rootNode.getNodeAtPath(SAMPLE_NAME_3);
assertEquals(childNode3, foundNode6);
}