KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgap > data > config > ConfigPropertyTest


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.config;
11
12 import org.jgap.*;
13 import junit.framework.*;
14
15 /**
16  * Tests the ConfigProperty class
17  *
18  * @author Klaus Meffert
19  * @since 3.0
20  */

21 public class ConfigPropertyTest
22     extends JGAPTestCase {
23   /** String containing the CVS revision. Read out via reflection!*/
24   private final static String JavaDoc CVS_REVISION = "$Revision: 1.1 $";
25
26   // number of chromosomes used in test case
27
private final static int NUM_CHROMS = 5;
28
29   // number of genes used in test case
30
private final static int NUM_GENES = 2;
31
32   public static Test suite() {
33     TestSuite suite = new TestSuite(ConfigPropertyTest.class);
34     return suite;
35   }
36
37   public void testConstruct_0() throws Exception JavaDoc {
38     ConfigProperty cp = new ConfigProperty();
39     assertEquals(0, cp.getName().length());
40     assertEquals(0, cp.getLabel().length());
41     assertEquals("JTextField", cp.getWidget());
42     assertFalse(cp.getValuesIter().hasNext());
43   }
44
45   public void testGetName_0() throws Exception JavaDoc {
46     ConfigProperty cp = new ConfigProperty();
47     final String JavaDoc name = "MysTRING";
48     cp.setName(name);
49     assertEquals(name, cp.getName());
50     assertEquals(name, cp.getLabel());
51     cp.setName("something");
52     assertEquals(name, cp.getLabel());
53   }
54
55   public void testGetWidget_0() throws Exception JavaDoc {
56     ConfigProperty cp = new ConfigProperty();
57     final String JavaDoc name = "MysTRING";
58     cp.setWidget(name);
59     assertEquals(name, cp.getWidget());
60   }
61
62   public void testGetLabel_0() throws Exception JavaDoc {
63     ConfigProperty cp = new ConfigProperty();
64     final String JavaDoc name = "MysTRING";
65     cp.setLabel(name);
66     assertEquals(name, cp.getLabel());
67   }
68
69   public void testAddValue_0() throws Exception JavaDoc {
70     ConfigProperty cp = new ConfigProperty();
71     final String JavaDoc name = "MysTRING";
72     cp.addValue(name);
73     assertTrue(cp.getValuesIter().hasNext());
74     String JavaDoc value = (String JavaDoc)cp.getValuesIter().next();
75     assertEquals(name, value);
76   }
77 }
78
Popular Tags