struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r481780 - in /struts/sandbox/trunk/tiles/tiles-core/src/test/java/org/apache/tiles/definition: TestUrlDefinitionsFactory.java UrlDefinitionsFactoryTest.java
Date Sun, 03 Dec 2006 15:22:03 GMT
Author: apetrelli
Date: Sun Dec  3 07:22:00 2006
New Revision: 481780

URL: http://svn.apache.org/viewvc?view=rev&rev=481780
Log:
Removed UrlDefinitionsFactoryTest and moved its test cases to TestUrlDefinitionsFactory.

Removed:
    struts/sandbox/trunk/tiles/tiles-core/src/test/java/org/apache/tiles/definition/UrlDefinitionsFactoryTest.java
Modified:
    struts/sandbox/trunk/tiles/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java

Modified: struts/sandbox/trunk/tiles/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java?view=diff&rev=481780&r1=481779&r2=481780
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/test/java/org/apache/tiles/definition/TestUrlDefinitionsFactory.java
Sun Dec  3 07:22:00 2006
@@ -24,6 +24,7 @@
 
 import java.net.URL;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Collections;
@@ -276,4 +277,32 @@
                 MockDefinitionsReader.getInstanceCount());
     }
 
+    /**
+     * Tests the calculatePostfixes method.
+     */
+    public void testCalculatePostfixes() {
+        Locale locale = Locale.US;
+
+        List<String> posts = UrlDefinitionsFactory.calculatePostfixes(locale);
+        assertEquals(3, posts.size());
+        assertTrue(posts.contains("_en_US"));
+        assertTrue(posts.contains("_en"));
+
+        locale = Locale.ENGLISH;
+        posts = UrlDefinitionsFactory.calculatePostfixes(locale);
+        assertEquals(2, posts.size());
+        assertTrue(posts.contains("_en"));
+    }
+
+    /**
+     * Tests the concatPostfix method.
+     */
+    public void testConcatPostfix() {
+    	UrlDefinitionsFactory factory = new UrlDefinitionsFactory();
+        String postfix = "_en_US";
+        assertEquals("a_en_US", factory.concatPostfix("a", postfix));
+        assertEquals("a_en_US.jsp", factory.concatPostfix("a.jsp", postfix));
+        assertEquals("file_en_US.jsp", factory.concatPostfix("file.jsp", postfix));
+        assertEquals("./path/file_en_US.jsp", factory.concatPostfix("./path/file.jsp", postfix));
+    }
 }



Mime
View raw message