You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/03/01 13:22:13 UTC

[GitHub] [maven-doxia-sitetools] elharo commented on a change in pull request #10: [DOXIASITETOOLS-109] handle more URI formats

elharo commented on a change in pull request #10: [DOXIASITETOOLS-109] handle more URI formats
URL: https://github.com/apache/maven-doxia-sitetools/pull/10#discussion_r386107854
 
 

 ##########
 File path: doxia-integration-tools/src/test/java/org/apache/maven/doxia/tools/DefaultSiteToolTest.java
 ##########
 @@ -56,4 +72,45 @@ public void testGetNormalizedPath()
         assertEquals( "file:/Documents and Settings/",
                 DefaultSiteTool.getNormalizedPath( "file://Documents and Settings/" ) );
     }
+
+    @SuppressWarnings("deprecation")
+    @Test
+    public void testGetRelativePath()
+    {
+        assertEquals(
+            ".." + File.separator + "bar.html",
+            tool.getRelativePath("http://example.com/foo/bar.html", "http://example.com/foo/baz.html"));
+    }
+
+    @SuppressWarnings("deprecation")
+    @Test
+    public void testGetRelativePath_same()
+    {
+        assertTrue(
+          tool.getRelativePath( "http://example.com/foo/bar.html", "http://example.com/foo/bar.html" ).isEmpty() );
+    }
+
+    @SuppressWarnings("deprecation")
+    @Test
+    public void testGetRelativePath_differentSchemes() {
+        assertEquals(
+          "scp://example.com/foo/bar.html",
+          tool.getRelativePath( "scp://example.com/foo/bar.html", "http://example.com/foo/bar.html" ) );
+      assertEquals(
+        "file:///tmp/bloop",
+         tool.getRelativePath( "file:///tmp/bloop", "scp://localhost:/tmp/blop" ) );
 
 Review comment:
   That's a should, not a MUST. This is a case of being liberal in what we accept. I agree that we should not emit such a weird URL, but we should handle it if someone gives one to us. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services