KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgap > event > GeneticEventTest


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

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

37   public void testConstruct_0() {
38     try {
39       new GeneticEvent("testEventName", null);
40       fail();
41     }
42     catch (IllegalArgumentException JavaDoc illex) {
43       ; //this is OK
44
}
45   }
46
47   /**
48    * @author Klaus Meffert
49    * @since 1.1
50    */

51   public void testConstruct_1() {
52     GeneticEvent event = new GeneticEvent(null, this);
53     assertNull(event.getEventName());
54   }
55
56   /**
57    * @author Klaus Meffert
58    * @since 3.0
59    */

60   public void testConstruct_2() {
61     GeneticEvent event = new GeneticEvent("testName", this);
62     assertEquals("testName", event.getEventName());
63   }
64
65   /**
66    * @author Klaus Meffert
67    * @since 3.0
68    */

69   public void testConstruct_3() {
70     GeneticEvent event = new GeneticEvent("testName", this, "aValue");
71     assertEquals("testName", event.getEventName());
72     assertEquals("aValue", event.getValue());
73   }
74
75   /**
76    * @author Klaus Meffert
77    * @since 1.1
78    */

79   public void testGetEventName_0() {
80     GeneticEvent event = new GeneticEvent("testEventName", this);
81     assertEquals("testEventName", event.getEventName());
82   }
83
84   /**
85    * @author Klaus Meffert
86    * @since 1.1
87    */

88   public void testGENOTYPE_EVOLVED_EVENT_0() {
89     assertTrue(GeneticEvent.GENOTYPE_EVOLVED_EVENT != null);
90     assertTrue(GeneticEvent.GENOTYPE_EVOLVED_EVENT.length() > 0);
91   }
92
93 }
94
Popular Tags