Author: ate
Date: Fri Jan 17 15:21:17 2014
New Revision: 1559143

URL: http://svn.apache.org/r1559143
Log:
SCXML-186: Groovy Expression evaluator support
- adding simple test for GroovyContext (copied from jexl)

Added:
    
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/GroovyContextTest.java
   (with props)

Added: 
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/GroovyContextTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/GroovyContextTest.java?rev=1559143&view=auto
==============================================================================
--- 
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/GroovyContextTest.java
 (added)
+++ 
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/GroovyContextTest.java
 Fri Jan 17 15:21:17 2014
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.scxml2.env.groovy;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class GroovyContextTest {
+
+    @Test
+    public void testNew() {
+        GroovyContext ctx = new GroovyContext();
+        Assert.assertNotNull(ctx);
+    }
+    
+    @Test
+    public void testPrepopulated() {
+        Map<String, Object> m = new HashMap<String, Object>();
+        m.put("foo", "bar");
+        GroovyContext ctx = new GroovyContext(m, null);
+        Assert.assertNotNull(ctx);
+        Assert.assertEquals(1, ctx.getVars().size());
+        String fooValue = (String) ctx.get("foo");
+        Assert.assertEquals("bar", fooValue);
+    }
+    
+    @Test
+    public void testSetVars() {
+        Map<String, Object> m = new HashMap<String, Object>();
+        m.put("foo", "bar");
+        GroovyContext ctx = new GroovyContext(m, null);
+        Assert.assertNotNull(ctx);
+        Assert.assertEquals(1, ctx.getVars().size());
+        String fooValue = (String) ctx.get("foo");
+        Assert.assertEquals("bar", fooValue);
+    }
+
+}

Propchange: 
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/GroovyContextTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/env/groovy/GroovyContextTest.java
------------------------------------------------------------------------------
    svn:keywords = Id


Reply via email to