1 package com.opensymphony.webwork.components; 2 3 import com.opensymphony.webwork.WebWorkTestCase; 4 import com.opensymphony.xwork.util.OgnlValueStack; 5 6 11 public class ComponentTest extends WebWorkTestCase { 12 public void testTranslateVariables() { 13 OgnlValueStack stack = new OgnlValueStack(); 14 15 String 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 |