KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgap > data > DataElementsDocumentTest


1 /*
2  * This file is part of JGAP.
3  *
4  * JGAP offers a dual license model containing the LGPL as well as the MPL.
5  *
6  * For licencing information please see the file license.txt included with JGAP
7  * or have a look at the top of class org.jgap.Chromosome which representatively
8  * includes the JGAP license policy applicable for any file delivered with JGAP.
9  */

10 package org.jgap.data;
11
12 import org.jgap.*;
13
14 import junit.framework.*;
15
16 /**
17  * Tests for DataElementsDocument class
18  *
19  * @author Klaus Meffert
20  * @since 2.6
21  */

22 public class DataElementsDocumentTest
23     extends JGAPTestCase {
24   /** String containing the CVS revision. Read out via reflection!*/
25   private final static String JavaDoc CVS_REVISION = "$Revision: 1.1 $";
26
27   public static Test suite() {
28     TestSuite suite = new TestSuite(DataElementsDocumentTest.class);
29     return suite;
30   }
31
32   /**
33    * @throws Exception
34    * @author Klaus Meffert
35    * @since 2.6
36    */

37   public void testConstruct_0()
38       throws Exception JavaDoc {
39     DataElementsDocument el = new DataElementsDocument();
40     assertNotNull(el.getTree());
41     assertEquals(0, el.getTree().getLength());
42   }
43
44   /**
45    * @throws Exception
46    * @author Klaus Meffert
47    * @since 2.6
48    */

49   public void testNewDocument_0()
50       throws Exception JavaDoc {
51     DataElementsDocument el = new DataElementsDocument();
52     assertEquals(DataElementsDocument.class, el.newDocument().getClass());
53   }
54
55   /**
56    * @throws Exception
57    * @author Klaus Meffert
58    * @since 2.6
59    */

60   public void testAppendChild_0()
61       throws Exception JavaDoc {
62     DataElementsDocument el = new DataElementsDocument();
63     DataElement child = new DataElement("xyz");
64     el.appendChild(child);
65     assertEquals(1, el.getTree().getLength());
66     assertEquals(child, el.getTree().item(0));
67     el.appendChild(child);
68     assertEquals(2, el.getTree().getLength());
69     assertEquals(child, el.getTree().item(1));
70   }
71
72 }
73
Popular Tags