KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > soto > state > code > GroovyStepTest


1 package org.sapia.soto.state.code;
2
3 import junit.framework.TestCase;
4
5 import org.sapia.soto.state.ContextImpl;
6 import org.sapia.soto.state.Result;
7 import org.sapia.soto.state.StateMachine;
8
9
10 /**
11  * @author Yanick Duchesne
12  * <dl>
13  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
14  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
15  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
16  * </dl>
17  */

18 public class GroovyStepTest extends TestCase {
19   public GroovyStepTest(String JavaDoc name) {
20     super(name);
21   }
22
23   public void testExecute() throws Exception JavaDoc {
24     ContextImpl ctx;
25     Result res = new Result(new StateMachine(), ctx = new ContextImpl());
26     GroovyStep gs = new GroovyStep();
27     gs.addImport("java.util.Date");
28     gs.setText("Date d = new Date(); result.setNextStateId(\"someState\");");
29     gs.onCreate();
30     gs.execute(res);
31     super.assertEquals("someState", res.getNextStateId());
32   }
33 }
34
Popular Tags