1 12 13 package com.openedit.webui.tree; 14 15 import com.openedit.BaseTestCase; 16 17 18 23 public class RepositoryTreeModelTest extends BaseTestCase 24 { 25 protected RepositoryTreeModel fieldModel; 26 protected RepositoryTreeNode fieldRootNode; 27 28 public RepositoryTreeModelTest(String inName) 29 { 30 super(inName); 31 } 32 33 36 public void testFindNode_Blank() 37 { 38 RepositoryTreeNode node = fieldModel.findNode(""); 39 assertSame("Should have returned the root", fieldRootNode, node); 40 } 41 42 45 public void testFindNode_Nonexistent() 46 { 47 RepositoryTreeNode node = fieldModel.findNode("/openedit/thisdoesnotexist/foo.bar"); 48 assertNull(node); 49 } 50 51 54 public void testFindNode_Normal() 55 { 56 RepositoryTreeNode node = fieldModel.findNode("/withdefault/index.html"); 57 assertNotNull(node); 58 assertTrue(node.getName().equals("index.html")); 59 assertSame( 60 "Should have found the correct node", 61 fieldRootNode.getChild("withdefault").getChild("index.html"), node); 62 } 63 64 67 public void testFindNode_Root() 68 { 69 RepositoryTreeNode node = fieldModel.findNode("/"); 70 assertSame("Should have returned the root", fieldRootNode, node); 71 } 72 73 76 public void testGetRoot() 77 { 78 assertTrue("Root should have some children", fieldRootNode.getChildCount() > 0); 79 } 80 81 84 protected void setUp() throws Exception 85 { 86 fieldModel = new RepositoryTreeModel(getFixture().getPageManager().getRepository()); 87 fieldRootNode = (RepositoryTreeNode) fieldModel.getRoot(); 88 } 89 } 90 | Popular Tags |