[jboss-cvs] jboss-seam/src/test/misc/org/jboss/seam/test ...
Norman Richards
norman.richards at jboss.com
Thu Feb 1 14:58:07 EST 2007
User: nrichards
Date: 07/02/01 14:58:07
Modified: src/test/misc/org/jboss/seam/test testng.xml
Added: src/test/misc/org/jboss/seam/test InterpolatorTest.java
Log:
JBSEAM-726: fix double interpolation bug, add basic tests
Revision Changes Path
1.6 +2 -1 jboss-seam/src/test/misc/org/jboss/seam/test/testng.xml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: testng.xml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/test/misc/org/jboss/seam/test/testng.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- testng.xml 9 Nov 2006 05:59:37 -0000 1.5
+++ testng.xml 1 Feb 2007 19:58:07 -0000 1.6
@@ -14,6 +14,7 @@
<class name="org.jboss.seam.test.RemotingTest"/>
<class name="org.jboss.seam.test.MethodExpressionParserTest"/>
<class name="org.jboss.seam.test.SecurityTest"/>
+ <class name="org.jboss.seam.test.InterpolatorTest"/>
</classes>
</test>
1.1 date: 2007/02/01 19:58:07; author: nrichards; state: Exp;jboss-seam/src/test/misc/org/jboss/seam/test/InterpolatorTest.java
Index: InterpolatorTest.java
===================================================================
package org.jboss.seam.test;
import java.util.Date;
import org.jboss.seam.core.Interpolator;
import org.testng.Assert;
import org.testng.annotations.Test;
public class InterpolatorTest
{
static final String CHOICE_EXPR = "There {0,choice,0#are no files|1#is one file|1<are {0,number,integer} files}.";
@Test
public void testFail()
{
Interpolator interpolator = Interpolator.instance();
Assert.assertEquals("3 5 7", interpolator.interpolate("#0 #1 #2", 3, 5, 7));
Assert.assertEquals("3 5 7", interpolator.interpolate("{0} {1} {2}", 3, 5, 7));
// this tests that the result of an expression evaluation is not evaluated again
Assert.assertEquals("{0}", interpolator.interpolate("{1}", "bad", "{0}"));
// this tests that embedded {} expressions are parsed correctly.
Assert.assertEquals("There are no files.", interpolator.interpolate(CHOICE_EXPR, 0));
Assert.assertEquals("There is one file.", interpolator.interpolate(CHOICE_EXPR, 1));
Assert.assertEquals("There are 2 files.", interpolator.interpolate(CHOICE_EXPR, 2));
Assert.assertEquals("12/31/69", interpolator.interpolate("{0,date,short}", new Date(0)));
}
}
More information about the jboss-cvs-commits
mailing list