Author: mgrigorov
Date: Tue Oct 11 14:42:19 2011
New Revision: 1181812

URL: http://svn.apache.org/viewvc?rev=1181812&view=rev
Log:
Add a unit test for escaping of '$'.


Modified:
    
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/util/string/interpolator/PropertyVariableInterpolatorTest.java

Modified: 
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/util/string/interpolator/PropertyVariableInterpolatorTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/util/string/interpolator/PropertyVariableInterpolatorTest.java?rev=1181812&r1=1181811&r2=1181812&view=diff
==============================================================================
--- 
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/util/string/interpolator/PropertyVariableInterpolatorTest.java
 (original)
+++ 
wicket/trunk/wicket-core/src/test/java/org/apache/wicket/util/string/interpolator/PropertyVariableInterpolatorTest.java
 Tue Oct 11 14:42:19 2011
@@ -16,19 +16,21 @@
  */
 package org.apache.wicket.util.string.interpolator;
 
-import junit.framework.TestCase;
+import org.junit.Assert;
+import org.junit.Test;
 
 /**
  * Tests {@link PropertyVariableInterpolator}
  * 
  * @author Gerolf Seitz
  */
-public class PropertyVariableInterpolatorTest extends TestCase
+public class PropertyVariableInterpolatorTest extends Assert
 {
        /**
         * 
         */
-       public void testWithValue()
+       @Test
+       public void withValue()
        {
                TestClass object = new TestClass("value");
                String result = 
PropertyVariableInterpolator.interpolate("${key}", object);
@@ -36,9 +38,22 @@ public class PropertyVariableInterpolato
        }
 
        /**
+        * A test that shows a usage of escape character. The first two '$' 
characters are squashed to
+        * '$' and '${key}' is interpolated to the respective value
+        */
+       @Test
+       public void withValueAndEscape()
+       {
+               TestClass object = new TestClass("3.24");
+               String result = 
PropertyVariableInterpolator.interpolate("$$${key}", object);
+               assertEquals("$3.24", result.toString());
+       }
+
+       /**
         * 
         */
-       public void testWithoutValue()
+       @Test
+       public void withoutValue()
        {
                String result = 
PropertyVariableInterpolator.interpolate("${key}", null);
                assertEquals("${key}", result.toString());


Reply via email to