incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r633010 - /incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/RedirectServletTest.java
Date Mon, 03 Mar 2008 09:49:50 GMT
Author: fmeschbe
Date: Mon Mar  3 01:49:48 2008
New Revision: 633010

URL: http://svn.apache.org/viewvc?rev=633010&view=rev
Log:
SLING-300 More unit tests

Modified:
    incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/RedirectServletTest.java

Modified: incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/RedirectServletTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/RedirectServletTest.java?rev=633010&r1=633009&r2=633010&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/RedirectServletTest.java
(original)
+++ incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/RedirectServletTest.java
Mon Mar  3 01:49:48 2008
@@ -52,7 +52,7 @@
         base = "/a";
         target = "/a/b.html";
         assertEquals("a/b.html", toRedirect(base, target));
-
+        
         base = "/a";
         target = "/a/b";
         assertEquals("a/b", toRedirect(base, target));
@@ -64,9 +64,71 @@
         base = "/a";
         target = "/a/b/c.html";
         assertEquals("a/b/c.html", toRedirect(base, target));
-
+        
         base = "/a";
         target = "/a/b/c";
+        assertEquals("a/b/c", toRedirect(base, target));
+    }
+    
+    public void testChildNonRoot() {
+        String base = "/x/a.html";
+        String target = "/x/a/b.html";
+        assertEquals("a/b.html", toRedirect(base, target));
+        
+        base = "/x/a";
+        target = "/x/a/b.html";
+        assertEquals("a/b.html", toRedirect(base, target));
+        
+        base = "/x/a";
+        target = "/x/a/b";
+        assertEquals("a/b", toRedirect(base, target));
+        
+        base = "/x/a.html";
+        target = "/x/a/b/c.html";
+        assertEquals("a/b/c.html", toRedirect(base, target));
+        
+        base = "/x/a";
+        target = "/x/a/b/c.html";
+        assertEquals("a/b/c.html", toRedirect(base, target));
+        
+        base = "/x/a";
+        target = "/x/a/b/c";
+        assertEquals("a/b/c", toRedirect(base, target));
+    }
+    
+    public void testChildRelative() {
+        String base = "/a";
+        String target = "b.html";
+        assertEquals("a/b.html", toRedirect(base, target));
+        
+        base = "/a";
+        target = "b";
+        assertEquals("a/b", toRedirect(base, target));
+        
+        base = "/a";
+        target = "b/c.html";
+        assertEquals("a/b/c.html", toRedirect(base, target));
+        
+        base = "/a";
+        target = "b/c";
+        assertEquals("a/b/c", toRedirect(base, target));
+    }
+    
+    public void testChildNonRootRelative() {
+        String base = "/x/a";
+        String target = "b.html";
+        assertEquals("a/b.html", toRedirect(base, target));
+        
+        base = "/x/a";
+        target = "b";
+        assertEquals("a/b", toRedirect(base, target));
+        
+        base = "/x/a";
+        target = "b/c.html";
+        assertEquals("a/b/c.html", toRedirect(base, target));
+
+        base = "/x/a";
+        target = "b/c";
         assertEquals("a/b/c", toRedirect(base, target));
     }
     



Mime
View raw message