KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > webwork > components > ComponentTest


1 package com.opensymphony.webwork.components;
2
3 import com.opensymphony.webwork.WebWorkTestCase;
4 import com.opensymphony.xwork.util.OgnlValueStack;
5
6 /**
7  * User: plightbo
8  * Date: Aug 3, 2005
9  * Time: 5:21:47 AM
10  */

11 public class ComponentTest extends WebWorkTestCase {
12     public void testTranslateVariables() {
13         OgnlValueStack stack = new OgnlValueStack();
14
15         String JavaDoc s = Component.translateVariables("foo: %{{1, 2, 3}}, bar: %{1}", stack);
16         assertEquals("foo: [1, 2, 3], bar: 1", s);
17
18         s = Component.translateVariables("foo: %{#{1 : 2, 3 : 4}}, bar: %{1}", stack);
19         assertEquals("foo: {1=2, 3=4}, bar: 1", s);
20
21         s = Component.translateVariables("foo: 1}", stack);
22         assertEquals("foo: 1}", s);
23
24         s = Component.translateVariables("foo: {1}", stack);
25         assertEquals("foo: {1}", s);
26
27         s = Component.translateVariables("foo: %{1", stack);
28         assertEquals("foo: %{1", s);
29     }
30 }
31
Popular Tags