/*
 * 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.wicket.util.string.interpolator;

import junit.framework.TestCase;

/**
 * Tests {@link PropertyVariableInterpolator}
 * 
 * @author Gerolf Seitz
 */
public class PropertyVariableInterpolatorTest extends TestCase
{
	/**
	 * 
	 */
	public void testWithValue()
	{
		TestClass object = new TestClass("value");
		String result = PropertyVariableInterpolator.interpolate("${key}", object);
		assertEquals("value", result.toString());
	}

	/**
	 * 
	 */
	public void testWithoutValue()
	{
		String result = PropertyVariableInterpolator.interpolate("${key}", null);
		assertEquals("${key}", result.toString());
	}

	private static class TestClass
	{
		private final String key;

		public TestClass(String key)
		{
			this.key = key;
		}
	}
}

@@ -878,32 +878,48 @@
 ort 
+org.
 junit.
-framework
+Assert;%0D%0Aimport org.junit
 .Test
-Case
 ;%0D%0A%0D
@@ -1064,16 +1064,14 @@
 nds 
-TestCase
+Assert
 %0D%0A%7B%0D
@@ -1081,32 +1081,40 @@
 **%0D%0A%09 * %0D%0A%09 */%0D%0A
+%09@Test%0D%0A
 %09public void tes
@@ -1110,21 +1110,17 @@
 ic void 
-testW
+w
 ithValue
@@ -1317,34 +1317,433 @@
 %09 * 
-%0D%0A%09 */%0D%0A%09public void testW
+A test that shows a usage of escape character. The first two '$' characters are squashed to%0D%0A%09 * '$' and '$%7Bkey%7D' is interpolated to the respective value%0D%0A%09 */%0D%0A%09@Test%0D%0A%09public void withValueAndEscape()%0D%0A%09%7B%0D%0A%09%09TestClass object = new TestClass(%223.24%22);%0D%0A%09%09String result = PropertyVariableInterpolator.interpolate(%22$$$%7Bkey%7D%22, object);%0D%0A%09%09assertEquals(%22$3.24%22, result.toString());%0D%0A%09%7D%0D%0A%0D%0A%09/**%0D%0A%09 * %0D%0A%09 */%0D%0A%09@Test%0D%0A%09public void w
 itho

Add a unit test for escaping of '$'.